tags:

views:

38

answers:

2

where should includes be stored in a file system??

A: 
include_path=".:/php/includes"

Or :

include_path=".;c:\php\includes"

(Documentation)

Moayad Mardini
+1  A: 

That's a pretty vague question... So the answers will probably be pretty vague too...

First of all, I suppose that you want to know where you can store files your application is including -- and that you know about include_path and set_include_path.

Now, here are a couple of thoughts :

  • For "system" includes, like a PEAR component, you might want to let PEAR install it where it want by default
    • On Linux, this often means somewhere like /use/share/php/
    • On Windows, I am not sure -- probably something like a PEAR directory inside the directory containing your PHP installation
    • At least, this is if your have access to that kind of directory -- generally means being administrator of the server.
  • For included files that are specific to your application, and must not be accessed directly via HTTP :
    • at least put them in a directory protected by some .htaccess denying access
    • better : put them outside of the directory served by the webserver
    • this way, they can't be accessed by users : only your application can use them.

In any case : you can put files almost whereever you want ; PHP just needs to be able to access them -- think about include_path, of course ; but also stuff like open_basedir restriction.

Pascal MARTIN