PHP root directory in Ubuntu
Posted: Sun Jun 15, 2008 1:07 pm
Hi,
I'm running ubuntu 8 (desktop edition) with apache, php5 and mySQL installed to test my files locally before uploading them online.
I successfully managed to change the root directory of the apache sever to /home/ursname/PHP, and as a result i could open files in that directory using http://localhost/whatever.php within a browser.
This worked fine until I revamped my php files to use php include to include navigation files and suchlike.
ie <?php include("/common/common-nav.php"); ?> within the /home/ursname/PHP directory wanting to get to the /home/ursname/PHP/common/common-nav.php directory.
Sadly, it didn't seem to like that and spat out an appropriately unhelpful error message in place of the navigation.
If however, the file was in the root directory, <?php include("common/common-nav.php"); ?> would work (ie without the initial forwardslash).
I have tried fiddling with the php.ini files to achieve the same root directory apache is using but have been unsuccessful. (aren't they meant to be using the same directory anyways?)
Sorry in advance (or should that be post-advance?) for boring your socks off and will be grateful for any input.
Thanks, Breadstick
I'm running ubuntu 8 (desktop edition) with apache, php5 and mySQL installed to test my files locally before uploading them online.
I successfully managed to change the root directory of the apache sever to /home/ursname/PHP, and as a result i could open files in that directory using http://localhost/whatever.php within a browser.
This worked fine until I revamped my php files to use php include to include navigation files and suchlike.
ie <?php include("/common/common-nav.php"); ?> within the /home/ursname/PHP directory wanting to get to the /home/ursname/PHP/common/common-nav.php directory.
Sadly, it didn't seem to like that and spat out an appropriately unhelpful error message in place of the navigation.
If however, the file was in the root directory, <?php include("common/common-nav.php"); ?> would work (ie without the initial forwardslash).
I have tried fiddling with the php.ini files to achieve the same root directory apache is using but have been unsuccessful. (aren't they meant to be using the same directory anyways?)
Sorry in advance (or should that be post-advance?) for boring your socks off and will be grateful for any input.
Thanks, Breadstick