paco Posted May 11, 2003 Posted May 11, 2003 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. Quote
Head Guru Posted May 11, 2003 Posted May 11, 2003 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. Quote
paco Posted May 11, 2003 Author Posted May 11, 2003 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. Quote
KevinW Posted May 12, 2003 Posted May 12, 2003 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 Quote
paco Posted May 12, 2003 Author Posted May 12, 2003 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 Quote
paco Posted May 12, 2003 Author Posted May 12, 2003 In this moment I've detected what has happened!: If you have this script (called borra.php): <? echo "document root: $DOCUMENT_ROOT"; ?> and you go to: http://207.44.242.2/~hispagi/borra.php It shows: /usr/local/apache/htdocs But if you go to (the same, after dns propagation): http://www.hispagimnasios.com/borra.php it shows: /home/hispagi/public_html Quote
KevinW Posted May 13, 2003 Posted May 13, 2003 So, the resolution to the problem was to wait until the update for your web / DNS name server had propogated? Good. -kw Quote
rayners Posted May 13, 2003 Posted May 13, 2003 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.