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
PHP root directory in Ubuntu
Moderator: General Moderators
Re: PHP root directory in Ubuntu
http://php.net/include/
http://bg.php.net/manual/en/ini.core.ph ... clude-path
I don't think web root directory has something to do with include() path argument.
Also:Files for including are first looked for in each include_path entry relative to the current working directory, and then in the directory of current script. E.g. if your include_path is libraries, current working directory is /www/, you included include/a.php and there is include "b.php" in that file, b.php is first looked in /www/libraries/ and then in /www/include/. If filename begins with ./ or ../, it is looked only in the current working directory.
http://bg.php.net/manual/en/ini.core.ph ... clude-path
I don't think web root directory has something to do with include() path argument.
There are 10 types of people in this world, those who understand binary and those who don't
-
Breadstick
- Forum Newbie
- Posts: 3
- Joined: Sun Jun 15, 2008 12:51 pm
Re: PHP root directory in Ubuntu
So your suggesting to change the include_path to something appropriate?
PS: What is the ".:" (dot-colon) all about?
PS: What is the ".:" (dot-colon) all about?
-
Breadstick
- Forum Newbie
- Posts: 3
- Joined: Sun Jun 15, 2008 12:51 pm
Re: PHP root directory in Ubuntu
Thanks a lot, your a star! It's working perfectly 
Re: PHP root directory in Ubuntu
Hello,
I had a few problems with PHP & Ubuntu, this site has good solutions for both of them.
I think this might help you
http://www.fixya.com/support/t879522-php_trouble
Good luck,
Tira
I had a few problems with PHP & Ubuntu, this site has good solutions for both of them.
I think this might help you
http://www.fixya.com/support/t879522-php_trouble
Good luck,
Tira