faqts : Computers : Programming : Languages : PHP : Function Libraries

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

15 of 16 people (94%) answered Yes
Recently 4 of 5 people (80%) answered Yes

Entry

Does require() use file system paths or web server paths?

Jul 12th, 1999 01:49
Nathan Wallace, Rasmus Lerdorf


require() uses file-system paths, not web server paths.  So

    require("/phpinc/vars.php3");

will look for the file vars.php3 in the directory /phpinc/ on your
server.  It does not look for http://www.yourdomain.com/phpinc/vars.php3

The best approach is probably to define your include_path.  For example:

    In your httpd.conf file, put this:

    php3_include_path .:/some/path/phpinc

Then simply do:

    require "vars.php3"

and PHP will first look for this file in . and then in /some/path/phpinc