Results 1 to 5 of 5

Thread: Make php functions available to all apps

  1. #1
    Join Date
    Dec 2008

    Question Make php functions available to all apps

    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?

  2. #2
    Join Date
    Jan 2007
    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.
    Jon Wire

    thepointless.com | rounded corner generator

    I agree with Apple. Flash is just terrible.

    Use CODE tags!

  3. #3
    Join Date
    Aug 2004
    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).
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  4. #4
    Join Date
    Nov 2008
    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.

  5. #5
    Join Date
    Dec 2008
    I see. This makes sense. I didn't realize it was targeted towards other cake apps.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center