Forum Moderators: coopster
I have spent 2 days on this already, tried every possible option to get it to work and have not been able to get it running.
I built my first PHP site using absolute paths for includes, and it works perfectly fine on my WinXP laptop with Apache.
However, once I moved it to the live server environment (Linux server running Apache), the includes no longer work.
The doc root is set properly (/www/webdev), however, I get an error every time it tries loading an include file with the following code:
<?php include("/topnav.php");?>
I got the following to work:
<?php include("/www/webdev/topnav.php");?>
as well as
<?php include("http://webdev/topnav.php");?>
However, I have had no luck getting the normal, clean absolute path reference to work.
Could someone please give me some ideas - I have very little time left, and don't want to recode the entire site with relative paths.
TIA
Both of these solutions are workarounds, and would require me to go through all of the pages on the site to update all include tags.
What's strange is that I placed these same files onto a different Linux server (my friends) and they worked perfectly off the bat with the absolute paths, without any configuration changes.
So, there must be some sort of a variable/setting on my server that is preventing it from functioning properly. What I need is at least an idea of where to look to find this setting and fix it that way.
Going through all the pages and replacing the include tags is the backup plan, which I am hoping to avoid.
Is tehre a way to add the $_SERVER['DOCUMENT_ROOT'] portion globally, so that I don't have to add it to every single include tag?
open_basedir? Either set it in the server's php.ini (or php5.ini) file or in .htaccess on a per-directory basis. open_basedir "limits all file operations to the defined directory and below". i.e.
open_basedir=/www/webdav/ to use /topnav.php as THAT root directory instead of the server's root or document root. Also check the "Paths and Directories" section of php.ini to see if there's something useful to you in there.