views:

385

answers:

5

In my live site I have php include() and require() that have full path such as: /www/mysite.com/webapps/mmh/head.php or /www/mysite.com/webapps/ROOT/zip/BoundaryWizard.php

Now, I want to do some local development on my windows machine (Xampp), so obviously none of those path work.

Is there a way to tweak the apache or php settings to dynamically translate say /www/mysite.com/webapps/mmh/ to c:\xamp\mysite\some_other_arbitrary_folder ?

I assume the best way would be to have used relative paths is the first place, but this is legacy code, could take a while to fix ...

A: 

If you don't want to change your code then create those directories.

You're in trouble if you ever have to switch hosts, so I'd recommend changing the code.

Azeem.Butt
A: 

I'd think that a search/replace wouldn't hurt too much in this case, as it's not difficult.

The other thing you could do is to move your DocumentRoot so that it's at C:\www\mysite.com...

Dave Vogt
A: 

Maybe is not the best solution but for a not so clever solution you can use a simlink (I don't know how it is called in windows systems, maybe just links?).

Eineki
A: 

You should define() your application path and then use find and replace in a text editor, most editors have that feature.

This means the code running in the development environment can't run unmodified in production, or test etc., environment. Better keep your code working in each environment and use a single configuration file to put these settings, plus things like database connection parameters etc.
Kwebble
+2  A: 

The right answer here (sorry) is that you should fix it. Have a common file where you declare a variable/contanst which is used to specify the path.

C'mon, it's not that hard. sed or any semi-good IDE will make changing a string on a bunch of files an easy task.

inerte