Re: failed to open stream: No such file or directory in
| From: | Mike Mapsnac | Date: | Mon, 15 Mar 2004 18:15:04 +0000 |
| Subject: | Re: failed to open stream: No such file or directory in | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-180485@lists.php.net to get a copy of this message | ||
thanks for explanation
Is it possible in php.ini declare $basedir(for libraries)?
From: Richard Davey <rich@launchcode.co.uk> Reply-To: Richard Davey <rich@launchcode.co.uk> To: php-general@lists.php.net Subject: Re: [PHP] failed to open stream: No such file or directory in Date: Mon, 15 Mar 2004 17:55:13 +0000 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_________________________________________________________________ Get business advice and resources to improve your work life, from bCentral. http://special.msn.com/bcentral/loudclear.armxindex.php = /var/www/htmlYou 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php