brycefinney Posted September 14, 2005 Posted September 14, 2005 Not sure if this is the right area for this, but I have a question about using PHP requires. I currently am building my site and using the require command to include a table of contents on my pages. However, I have to change the paths every time I change from testing locally (using Apache server, PHP 5) to uploading to my live site. Is there anything I can do to make both use the same paths? Quote
TCH-Don Posted September 14, 2005 Posted September 14, 2005 I ran into the same thing On my local server the root folder is used by the server so I use folders for each site and can't get include $_SERVER['DOCUMENT_ROOT']."/filename.php"; to work locally. So I just use relative or put the include files in a sub folder and include ("folder/filename.php"); You could create two text files for local and remote called path.php and include it and have it set the include path for where ever you are. Quote
brycefinney Posted October 4, 2005 Author Posted October 4, 2005 I ran into the same thingOn my local server the root folder is used by the server so I use folders for each site and can't get include $_SERVER['DOCUMENT_ROOT']."/filename.php"; to work locally. So I just use relative or put the include files in a sub folder and include ("folder/filename.php"); You could create two text files for local and remote called path.php and include it and have it set the include path for where ever you are. Well I'd sort of given up on this but then I remembered your comment about using the two text files. Could you explain that in a little more detail? Perhaps give me an example? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.