Robert Granlund
asked on
Absolute Path Root
When I run
D:\websites\M\mysite\
To enter that into a config file do I write it like:
/D/websites/M/mysite/ ???
<?php
echo __FILE__;
?>
to get the absolute path, I get this:D:\websites\M\mysite\
To enter that into a config file do I write it like:
/D/websites/M/mysite/ ???
ASKER
You went over my head Ray.
Let's deconstruct the problem. Why (what business or technical reason) do you want the absolute path to the root?
ASKER
I'm helping a friend install an image gallery to their website. They bought the code and there is almost no documentation. In the config file, it asks for the absolute path.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To make things more interesting, I know that on some web hosting you can not use the 'absolute path' because your directories are "chrooted" (?) so that you can only use paths inside your own directories. Using an absolute can just result in an error.
But that said, you can find the context-appropriate directory separator slash in the PHP constant DIRECTORY_SEPARATOR. Just use that in place of any hard-wired slash and you'll be OK even if your scripts are ported to different operating systems.