Re: include_once changed behavior?
| From: | Jason Wong | Date: | Mon, 07 Jun 2004 19:39:38 +0000 |
| Subject: | Re: include_once changed behavior? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-187835@lists.php.net to get a copy of this message | ||
On Tuesday 08 June 2004 03:21, Mattias Thorslund wrote:
> In order to keep configuration files outside the web root I use:
>
> include_once('../config.php');
>
> This used to work also when running php scripts from the command line.
> Now I have a new server and I get "no such file or directory" when using
> this construct from the command line.
>
> I have worked around this by doing this:
>
> $main_folder = realpath(dirname($_SERVER['SCRIPT_FILENAME']).'/..');
> include_once($main_folder . '/config.php');
>
> The original, simpler construct still works when calling the page from a
> web browser, just not when I run it from the command line.
>
> The new server has a more recent version of PHP (4.3.4). I don't have
> the php version of the old server but it was on RedHat 9 - now I'm on
> Mandrake 10.
>
> What could be the difference that caused this?
Possibly:
manual > Using PHP from the command line > -c switch
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
You have many friends and very few living enemies.
*/