ID: 20452 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux Mandrake 9.0 PHP Version: 4.2.3 New Comment:
I think you don't understand me. In which directory are you in when executing a script ? The directory where the symlink is or the directory where the original file is ? Well, depending if the path goes backwards or not (with two dots '..') the path to calculate a relative path is one or the other. Do you understand me ? require("dir/include.php"); loads /var/php/scripts/dir/include.php while require("../dir/include.php"); loads /var/www/dir/include.php. They're calculated from diferet base paths, please, take a look at the example I gave, exactly at the paths, there is where the problem is. One path is calculated from where the file is, and the other path is calculated from where the symlink is, and the only diference between both paths is the '..'. To give you a better example. Original script: /var/php/scripts/index.php Symlink: /var/www/htdocs/index.php -> ../../php/scripts/index.php Acording to what you say (which makes sense to me) this two lines should include the same file: require("include.php"); require("../scripts/include.php"); right ? well, the first one fill succesfully include /var/php/scripts/include.php while the second one will include /var/www/scripts/include.php (because this path instead of being /var/php/scripts/../scripts/include.php is /var/www/htdocs/../scripts/include.php) It is resolved from the location of the symlink and not the original file. Previous Comments: ------------------------------------------------------------------------ [2002-11-17 18:06:28] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php When including a file, it is included based on the directory you are currently in. If that directory was /var/php/scripts/ , then all relative paths will be calculated based on that directory. ------------------------------------------------------------------------ [2002-11-17 00:17:26] [EMAIL PROTECTED] I don't have a 'working' on line example to show you this and I don't have posibilities to do it right now, I'm sorry, but I'll try to show you here what I mean with an example. Let's supouse I have one script in this file /var/php/scripts/index.php and I have a symlink to that file like this /var/www/htdocs/index.php -> ../../php/scripts/index.php and this file contains the following: <?php require("dir/include.php"); require("../dir/include.php"); ?> When I run it, for require("dir/include.php"); it tryes to include /var/php/scripts/dir/include.php (the relative path from the original location of the file) but for require("../dir/include.php"); it tryes to icnlude /var/www/dir/include.php (real path for /var/www/htdocs/../dir/include.php) (it is resolving the relative path from the symlink and not the original file). I'm not sure with behaviour is the right one, but this mix is not the right one for sure, I think. I hope it helps, if you need more help, just contact me. Thank you. ------------------------------------------------------------------------ [2002-11-16 11:48:31] [EMAIL PROTECTED] Could you show an example of what you mean? ------------------------------------------------------------------------ [2002-11-15 17:35:13] [EMAIL PROTECTED] I'm requesting a page, the file that is called is index.php, but this file is a symlink from somewhere else. When I require a file from index.php, if there's no '..' (dots) on the path (a relative path, but not going back), the relative path is from where the original file is, but if there are '..' on the path, the relative path is from where the symlink is (although php identifies the script as the original file in the error message). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20452&edit=1