On Thu, May 11, 2006 3:17 pm, Steven Stromer wrote: > 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 would require that your have something like this on your server: /bin /root /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. Don't put the '/' in the front, and they are concatenated. Put a '/' on the front, and PHP assumes you are giving a COMPLETE and ABSOLUTE path in the file-system. > 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? include 'lib/included.php'; should have worked in the first place. Go back to that, and then double-check spelling and include_path from within the PHP script. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php