note 46774 added to function.include

From: Date: Fri, 22 Oct 2004 18:17:37 +0000
Subject: note 46774 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-78956@lists.php.net to get a copy of this message
It appears that as require and include search for the file to include, they have a strange behavior as regards symlinks. Consider the following: /thisdir/myprogram.php -> /otherdir/myprogram.php /thisdir/mycommon.php And as you are running under a webserver, it's accessing myprogram.php as /thisdir/myprogram.php. Seems normal. Now, inside myprogram.php you have: require_once('mycommon.php'); This will NOT find /thisdir/mycommon.php ! It will instead apparently search /otherdir as myprogram.php's current directory and come up empty, causing require to fail. I proved this by finding that if /otherdir/mycommon.php exists, it will get included instead. This borders on a bug for me. It means that I can't have app instances which are made of symlinks to a base set of php programs but having separate configuration variables as might be included in a require statement like above. I am still looking for ways around this, but I thought in the meantime I'd mention it. ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46774 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46774&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46774&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46774&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46774&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46774&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46774&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+46774&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#78956) next »