|
Posted by Michael Fesser on 10/11/07 22:08
..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
Navigation:
[Reply to this message]
|