In my live site I have php include() and require() that have full path such as: /www/mysite.com/webapps/mmh/head.php o开发者_StackOverflow中文版r /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 ...
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.
You should define() your application path and then use find and replace in a text editor, most editors have that feature.
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.
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...
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?).
精彩评论