Jean-Pierre Gallou schrieb: > Hi, > > I have problems with relative paths and 4.3.0. Include() do not seem to > work the same way in 4.3.0 and 4.2.1. Consider this test: > > test/ > |- testinclude.php <? include ('inc/inc1.php'); ?> > |- inc/ > |- inc1.php <? include ('inc/inc2.php'); ?> > |- inc2.php OK > > With PHP 4.2.1, <http//my.server.com/test/testinclude.php> works OK. > With 4.3.0, I get: > Failed opening '/inc/inc2.php' for inclusion \ > include_path='.:..:/usr/local/php-4.3.0/lib/php') in \ > /usr/local/www/htdocs/tests/inc/inc1.php on line 1 > > With a modified inc1.php: > <? include ('inc2.php'); ?> > this test is OK with 4.3.0, but gives an error with 4.2.1. > > It appears that paths are relative > - to the main script in 4.2.1, > - to the including script in 4.3.0 > (but .. in include_path does not work). > > I can't seem to be able to write something OK for both versions (except > if giving full pathnames). By the way, this is on Solaris, and > safe_mode if off. > > Any suggestion? >
Failed opening '/inc/inc2.php' looks like that he try an absolute path from the root / ... maybe try something like include('./inc/inc1.php'); ^^ instead. The "include_path" tells PHP only where to look for the file . = same directory .. = parent directory if it is a single file or relativ path, but '/inc/inc2.php' is an absolute path from the root ... -- @ Goetz Lohmann, Germany | Web-Developer & Sys-Admin \/ ------------------------------------------------------ () He's the fellow that people wonder what he does and || why the company needs him, until he goes on vacation. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php