View Full Version : Problem setting root variable

02-20-2008, 06:51 PM

I am having a problem with a PHP site that I moved to a new hosting account. The problem is with setting the $rootBase variable in the index.php file. Since moving the files I am getting the following error:

Warning: main(/data/15/1/104/140/1430303/user/1536306/htdocs/_inc/config.php) [function.main]: failed to open stream: No such file or directory in /data/15/1/104/140/1430303/user/1536306/htdocs/website2/index.php on line 7

The current variable string in my index file looks like this:


I think the problem stems from the fact that with my new web host, the files are actually in a sub directory of /htdocs. On the old server this was not the case, but my new shared web host makes you place all web sites in their on directory like /htdocs/website2. It appears that the script is looking for the files in root /htdocs directory.

My questions is this; Since I am new to PHP coding, I do not know the proper syntax to use to change the $rootBase variable string to were it will look in the proper subdirectory (/htdocs/website2) for the files.

Can this be done? Or maybe there is a .htaccess change I can implement to make this happen? Any suggestions would be appreciated.


02-20-2008, 07:16 PM

$rootBase = $_SERVER["DOCUMENT_ROOT]."/website2";

Good luck

02-21-2008, 02:40 AM
That worked. Thanks