include_path and absolute paths in include functions

From: Date: Thu, 11 May 2006 20:17:34 +0000
Subject: include_path and absolute paths in include functions
Groups: php.general 
Request: Send a blank email to php-general+get-236028@lists.php.net to get a copy of this message
For years I was lulled into thinking I understood php include functions... I have always used relative paths in my include and related functions, for instance: include_once ("lib/included.php"); However, I am now needing to switch to absolute paths: include_once ("/lib/included.php"); This doesn't work. Generates error: Warning: main(/lib/included.php) [function.main.html]: failed to open stream: No such file or directory in /var/www/sites/sitename/index.php on line 8 Warning: main() [function.include.html]: Failed opening '/lib/included.php' for inclusion (include_path='.:/var/www/sites/sitename') in /var/www/sites/sitename/index.php on line 8 I would think I need to correct the include_path in php.ini, but the include_path seems right. The file I want to include does exist at: /var/www/sites/sitename/lib/included.php I always believed that the include_path and the path in the include() function were simply concatenated, but I now think that I am just plain wrong, as the error is reproducible on OS X, Fedora and everywhere else I test it. Am I not taking into account some other directive that affects include_path, like 'doc_root' in php.ini, or 'DocumentRoot' or 'ServerRoot' in httpd.conf? Or is this a permissions issue of some sort? Thanks for any help in advance!

« previous php.general (#236028) next »