I was setting up CakePHP yesterday and I passed over something about making the CakePHP libraries available to all applications by copying them to some folder, but I can't find it in the manual now.
I'm not wanting to necessarily do it with CakePHP, but with my own UDFs. Where do I place these functions? Do I put them in the extensions folder and then enable them in the php.ini? Or do I just have to require() them?
You can auto-include certain libraries with the PHP auto_prepend_file directive. However, it's probably a better practice to either explicitly include()/require() files as needed or to use class autoloading.
As far as I know you would just have to require() the relevant files. Where the files are should not matter, other than you might want them in your PHP include_path (or change the include_path setting to point to wherever they are).
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Cake does it by simply defining the location of the cake library as a constant and building include paths using that. As mentioned above the cake core still uses require/include and class autoloading as normal - using a library location constant just allows the core to be shared by many apps.
Bookmarks