Hi there:
I want to know if the "include_path" really works or not in php.ini, it seems like php won't find files under this directory.
For example: I made a tar for php files. If it's extracted, the main directory will be ./main, and it contains two sub folders, ./main/daemon, ./main/class/. Users could extract the tar file to any directories like /tmp, and then if we modify the include_path in php.ini as the following:
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; UNIX: "/path1:/path2"
include_path = ".:/php/includes:/tmp/main/"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
in my code, a.php under the subfolder daemon, I have some require statements like: require("class/b.php") . If the current path is /tmp/main, then in command line, php a.php will run without any problems; however, in any other directories, for example: under /tmp/main/daemon, php. a.php won't work, it always have some strange error messages in php.err. I doubts php will just look for files under the current working directory, not all the directories under include_path, is that right? Thanks!
A question about php include path
Moderator: General Moderators
-
WilliamLou
- Forum Newbie
- Posts: 12
- Joined: Fri Mar 14, 2008 1:32 pm
-
WilliamLou
- Forum Newbie
- Posts: 12
- Joined: Fri Mar 14, 2008 1:32 pm
Re: A question about php include path
any suggestions?!
Re: A question about php include path
PHP will look for relative files in whatever location the file is currently in and whatever you include in the includes directive in php.ini.