|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-05-09 20:24 UTC] wez@php.net
[2004-05-09 21:03 UTC] mzajonc at pomona dot edu
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 05:00:01 2025 UTC |
Description: ------------ It appears that when running php from the command line relative paths such as require("../include/test.php") do not function the same in php4.2.3 and php5.0.0RC2. Relative paths in php5 are computed relative to the current directory not relative to the script. This causes commands (typically run in crontab) like php -f /www/foo/bar/test.php to break if test.php has require/include statements that are relative. Reproduce code: --------------- The test script (located: /www/www.test.com/test/test.php): <?php echo realpath("../test/test.php") ?> From command line: $ cd /www $ php -f /www/www.test.com/test/test.php Expected result: ---------------- /www/www.test.com/test/test.php Actual result: -------------- When php4 is used, the output is as expected. When php5 is used, realpath fails and returns FALSE. It appears to consider realpath("../test/test.php") to be "/test/test.php" (given current directory of /www). However, if you do "cd /www/www.test.com/test" and then run the same command, the realpath returns what is expected (since script location is the same as the current directory).