Re: failed to open stream: No such file or directory in

From: Date: Mon, 15 Mar 2004 17:55:13 +0000
Subject: Re: failed to open stream: No such file or directory in
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-180483@lists.php.net to get a copy of this message
Hello Mike, Monday, March 15, 2004, 5:43:14 PM, you wrote: MM> But When I try to declare the library in /var/ww/html/account/ MM> include('lib/account/lib_main.php'); lib_main.php = /var/www/html/lib/lib_main.php index.php = /var/www/html You are including files RELATIVE to the location of the script. At the point in which you try to include the lib_main file, you are currently in the account directory, so it's trying to look for: /var/www/html/account/lib/account/lib_main.php which, needless to say, doesn't exist. A good solution to save you some hassle will be to define a global variable/constant called something like $basedir and set that. $basedir = "/var/www/html"; Now just use this in all your include lines: include "$basedir/lib/lib_main.php"; This will work from *anywhere* and not fail. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html

« previous php.general (#180483) next »