Hostname / Document Root Problems

CreedFeed

Member
Jan 22, 2004
14
0
151
Just got a new Red Hat 3 Enterprise server with Cpanel/WHM set up on it. When I go into WHM and create an account everything works just fine. I create an account for www.domain.com - document root is set to /home/domain/public_html and the hostname is set to domain.com

When I set up a second account, www.mysite.com, it pulls the hostname and document root from the first domain created. i.e. for the next account I make the document root is set to be /home/domain/public_html and not /home/mysite/public_html - and the host name for that account is set to domain.com and not mysite.com ...

I noticed this problem at first when the second account I created was using PHP files that utilized the $_SERVER['DOCUMENT_ROOT'] variable. It kept printing the doc root as the previous account's doc root and would create errors because the files the pages required were not being found.

Any idea what the problem is?
 

ciphervendor

Well-Known Member
Aug 26, 2002
1,050
0
166
Submit a bug report to cPanel. Be sure to include login details for your box to epedite a resolution.
 

IvanV

Registered
Jul 30, 2003
1
0
151
Any updates on this?
Looks like there is a problem with mod_rewrite.

A virtual host is defined by two pieces of information: its IP address, and the contents of the Host: header in the HTTP request. The dynamic mass virtual hosting technique is based on automatically inserting this information into the pathname of the file that is used to satisfy the request. This is done most easily using mod_vhost_alias, but if you are using a version of Apache up to 1.3.6 then you must use mod_rewrite.
Source from apache docs

Can this be fixed somehow?
 

jeffkee

Registered
Jan 22, 2009
3
0
51
My Quick Solution

I have the same problem. But I found a quick solution to this - may not apply to everybody though depending on server setup.

Go to "List Accounts"
And then under the list, go to the one that is giving you the wrong DOCUMENT_ROOT.
On the IP section (3rd column?), click on the EDIT button.
Change the default IP to any of the available IP addresses you have on hand to give the site a unique IP.
Try typing in the unique IP in your browser to a page that has

Code:
echo $_SERVER['DOCUMENT_ROOT'];
Then it seems to show the right DOCUMENT_ROOT. However, I have not tested this after the DNS info has been forwarded so I cannot guarantee what will happen once the domains point properly.