A question about php include path
Posted: Mon Jan 19, 2009 1:41 pm
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!
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!