Directory path issue

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have one php application that uses server path like /var/www/
direcory in queries and also while calling files etc, and uses
__FILE__ to fetch the path.

I have installed apache on Windows XP and when I try to runs the
application locally, script results in C:\apache\htdocs\testapp
\index.php and here application stops working.

Can anybody suggest or give an idea how I can have the similar path
while working locally.


Re: Directory path issue


Quoted text here. Click to load it

I do something similar in my own framework. My init script uses __FILE__
to determine the current path and to define some constants based on
that. Since these scripts have to run on both Linux and Windows, I call
strtr() first to translate all '' to '/', before I split __FILE__ into
its parts. Internally all my scripts work with the Unix-like directory
separators. PHP can handle that, even if it runs on a Windows box.


Re: Directory path issue

kanwal wrote:
Quoted text here. Click to load it

$_SERVER['DOCUMENT_ROOT'] contains the path to the root directory of  
your server.  Everything can be based off of this.  And no parsing  
necessary, as is required with __FILE__.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline