Absolute path with WampServer?
Posted by: Cell Guy (---.hsd1.va.comcast.net)
Date: September 16, 2012 09:47PM

I have a php file, call it file1.php, that is included from files in different directories. Now, file1.php needs to include another php file, call it file2.php, but the problem is that the relative path to file2.php will change since file1.php is included from different places.

Therefore, I think I need to use an absolute path. For instance, on my web server I can use the path "/home/username/public_html/...", but I cannot figure out how to do this with WampServer.

Any ideas?

Thanks for your help!

Options: ReplyQuote
Re: Absolute path with WampServer?
Posted by: stevenmartin99 (Moderator)
Date: September 16, 2012 09:59PM

you can do the same once you understand these four structures

href="file.php" looks in the current directory (relative)

href="../file.php" is back one folder from the current directory (relative)

href="/file.php" is all the way back to the server root (absolute)

http:/ /locahost/file.php is an absolute path to a file (absolute)

you most likely want to use the third , because you dont need to mention a URL , which may change in the future

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]



Edited 1 time(s). Last edit at 09/16/2012 10:03PM by stevenmartin99.

Options: ReplyQuote


Sorry, only registered users may post in this forum.