Web Hosting Talk







View Full Version : php code


N8Webs
08-11-2005, 11:07 PM
I am forced to move to a new hosting account and am having problems with some php coding.

The original coding is:

<?php

$thefile = "/home/username/domains/domainname.com/public_html/$page.shtml";
if (file_exists($thefile))
{
include("$thefile");
}
else
{
include("/home/username/domains/domainname.com/public_html/default.shtml");
}

?>

The new hosting company allows me to have multiple domains, however it puts each domain in a unique root folder

<?php

$thefile = "/home/httpd/vhosts/domain.com/httpdocs/$page.shtml";
if (file_exists($thefile))
{
include("$thefile");
}
else
{
include("/home/httpd/vhosts/domain.com/httpdocs/default.shtml");
}

?>

The beauty was with server #1 I had several domains under a similar root path and thus could have several web sites that point to one common /public_html/ folder.

With server #2, when I setup the code I get the following error:

main(): open_basedir restriction in effect. File(/home/httpd/vhosts/domain2/httpdocs/default.shtml) is not within the allowed path(s): (/home/httpd/vhosts/domain1/httpdocs:/tmp) in /home/httpd/vhosts/domain1/httpdocs/index2.php on line 37

Any thoughts?

Thanks,
Michael

funkytaco
08-11-2005, 11:35 PM
It looks like your old host may have used cPanel and your current one may be using Plesk and they work a little bit differently.

You need to open a ticket with your hosting provider and ask them for the correct path to use to the file. Or possibly if you FTP you should be able to see the correct path to the file.

But basically, the path to the file may be wrong and it is saying you arent allowed to open that path.

N8Webs
08-12-2005, 07:41 AM
It works now - not sure what happened.

Thanks
Michael

WebPeopleChat
08-12-2005, 09:05 AM
I Hate php when something goes wrong they have the line code but sometimes it doesnt help