Problem with include PHP 4.3.0
| From: | Jean-Pierre Gallou | Date: | Tue, 04 Feb 2003 10:31:58 +0000 |
| Subject: | Problem with include PHP 4.3.0 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-134238@lists.php.net to get a copy of this message | ||
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?