Directory path issue

Directory path issue

am 11.10.2007 23:43:54 von kanwal

Hi,

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.

Thanks

Re: Directory path issue

am 12.10.2007 00:08:36 von Michael Fesser

..oO(kanwal)

>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.

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.

Micha

Re: Directory path issue

am 12.10.2007 03:15:23 von Jerry Stuckle

kanwal wrote:
> Hi,
>
> 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.
>
> Thanks
>
>

$_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.
jstucklex@attglobal.net
==================