NYCPHP Meetup

[nycphp-talk] apache2/php5 and include ( ) paths

Mikhail Ledvich php.mail.list at clickfacts.com
Thu Jun 29 14:15:56 EDT 2006


Jon,
You're completely right. When running  print_r($_SERVER) from the 
localhost browser I get
$_SERVER["DOCUMENT_ROOT"] = C:/AppServ/www
however, when running it from command line it's empty.

Perhaps excuse the naive question, but how do I set C:/AppServ/www as 
the Document root for when I run files from the command line?

Thank you again,
Mikhail


------------------------------
> Message: 3
> Date: Thu, 29 Jun 2006 07:10:50 -0400
> From: Jon Baer <jonbaer at jonbaer.com>
> Subject: Re: [nycphp-talk] apache2/php5 and include ( ) paths
> To: NYPHP Talk <talk at lists.nyphp.org>
> Message-ID: <C2D4040E-0D55-43EE-B2B1-23A0A8CB5359 at jonbaer.com>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
> What happens when you add the -C flag to the mix?  From what I recall  
> on windows you path is actually set  where your interpreter is setup  
> (ie c:/php5/php.exe) so your 'document root' in that case is really  
> c:/php5.  I could be wrong, trying running a print_r($_SERVER) from  
> your CLI program to see what differences you get.
>
> Are you using PHP via Cygwin?
>
> - Jon
>
> On Jun 28, 2006, at 10:46 PM, Mikhail Ledvich wrote:
>
>   
>> Hi all,
>>   Perhaps someone can help me out with a weird error I am  
>> experiencing.
>> I've installed Apache2, PHP5, MySQL5 on a WindowsXP machine and
>> everything works like a charm. Except when I try to use php.exe from
>> command line. If I execute a php file from command prompt using the
>> php.exe, if the include/require paths are not entirely hardcoded
>> (c:\AppServ\www ...) but are dynamically set (../../config.php): it
>> throws errors.
>>
>> Warning: include_once(../../config.php): failed to open stream: No  
>> such
>> file or directory in c:\AppServ\www\fill_combination.php on line 10
>>
>> However, if I put the same into the browser, it works, but from local
>> command line I get path errors. Any ideas? I am at the end of my wits.
>>
>> Thanks,
>> mikhail
>>
>>
>> _______________________________________________
>> New York PHP Community Talk Mailing List
>> http://lists.nyphp.org/mailman/listinfo/talk
>> New York PHP Conference and Expo 2006
>> http://www.nyphpcon.com
>> Show Your Participation in New York PHP
>> http://www.nyphp.org/show_participation.php
>>
>>     



More information about the talk mailing list