Jump to content

Recommended Posts

Posted

I use the apache variable $DOCUMENT_ROOT for the header of all my php files. It should point to the root of my public directory:

 

/home/hispagi/public_html/

 

However, it points to:

/usr/local/apache/htdocs/

 

Are there any way of change this behaviour? , my pages don't work for this reason (in other hostings I had not this problem)

 

Thanks in advance.

Posted

Hi,

 

cPanel servers use custom binaries so therefore this behavior is standard and can not be modified.

 

All cPanel servers use the same doc root.

Posted

Thank you :)

 

I liked to use $DOCUMENT_ROOT instead of the path, because of the compatibility between the remote host, and my localhost (to testing). Well, thanks.

Posted

Head Guru -- can you please reconfirm your answer?

 

Paco expected that $DOCUMENT_ROOT would give /home/{username}/public_html/ but instead got /usr/local/apache/htdocs

 

But when I run either the the phpinfo() script or the env.pl script on a TCH server, they both report back that the contents of $DOCUMENT_ROOT as: /home/{username}/public_html

 

Am i missing something?

-kw

Posted

I received this message from Alan Ho (summarize):

----------

I've created a test.php page and it shows document_root being set to the correct

home folder. You should check your PHP coding to make sure you are referencing the correct global variable.

----------

 

Indeed, at this moment, it works OK , but my old test script was this:

 

<? echo "document root: $DOCUMENT_ROOT"; ?> , and it said:

/usr/local/apache/htdocs

 

Now it say:

/home/hispagi/public_html

 

Perhaps somebody has changed anything. Well, it's all OK now :huh:

Posted

I imagine it's not so much a DNS issue as it is an Apache Virtual Host issue. If Apache knows that it's running under http://www.hispagimnasios.com/ (i.e. when the script is called with that as the base URL), it knows that the document root for that Virtual Host is /home/hispagi/public_html. If it is called with the IP number, it doesn't know that the page it is serving exists under http://www.hispagimnasios.com/, so the document root in that case is just the default server root (/usr/local/apache/htdocs).

 

If that makes any sense. B)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...