Value $_SERVER['DOCUMENT_ROOT'] detect as wrong

Avatar
  • Answered
Value $_SERVER['DOCUMENT_ROOT'] detect as wrong

I tried to run php script http://vps6529.inmotionhosting.com/~mylogin/restore.php using temperary url, but error occurs that "this script must be started from Web Server".

This error occurs when not equal "realpath(dirname(__FILE__))" and "realpath($ _SERVER['DOCUMENT_ROOT'])". Why?

Using File Manager, I see that all files (scripts) should be placed in /home/mylogin/public_html and my restore.php script is placed that.
But value $ _SERVER['DOCUMENT_ROOT'] detect that the file placed in /usr/local/apache/htdocs. It's mean that the apache directive wrong or because I use temperary url? How can I fix it?
Avatar
anonymous
Hello, I looked at your script and the reason your it does not work when you go to it via your temporary URL is due to the fact that you need to visit with your domain. You can do this by performing a host file modification on your computer. Once I did the same and visit http://your-domain.com/restore.php I was then forwarded to an archive creation page. Please let us know if you have any other questions. Best Regards, TJ Edens