• GoDaddy Community
  • Managed WordPress Hosting
  • Managed WordPress Hosting

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 

    PHP 5.6.30 can no longer access relative files outside of DOCUMENT_ROOT

    Some time in the afternoon of Monday, September 30th, between 4:30pm and 7:30pm, my website broke.

     

    My website stores some scripts and other files relative to and outside of _SERVER["DOCUMENT_ROOT"] (which now is '/var/www' - I am not sure what it was before the website broke). For example, my theme's WordPress functions.php reads scripts outside that root by executing this:

     

     require_once($_SERVER["DOCUMENT_ROOT"] . '/../my-script-directory/app-setup.php');

     

    '/var/www' seems to actually refer to '/home/my-username/html', so I expected that '/var/www' would reference '/home/my-username', but I do not know how '/var/www' is actually set up - is it some kind of alias set up at run-time to service page requests?

     

    This has worked for two years, but started failing on Monday. After some tests, it seems that any file referenced by going outside the DOCUMENT_ROOT fails - even  a simple file_exists(). Permissions are generous, with at least 'r-xr-xr-x' on the related files and folders (they were originally at least 'r-xr-x---', but I relaxed them while testing).

     

    My reasons for accessing scripts relative to DOCUMENT_ROOT/../ (as well as other files I did not want visible in the document root) are that I found several suggestions of doing just this, and it has worked for years. Replacing relative paths with absolute ones, such as below, does not work: again, PHP cannot see the files and even file_exists(...)===false.

    require_once('/home/my-username/my-script-directory/app-setup.php');

    GoDaddy support tells me that SELinux has not been enabled. There is no .htaccess in '/home/my-username', and although I just noticed there is one in '/home/my-username/my-script-directory', none of that should affect PHP's require_once(). phpinfo() lists directive 'open_basedir' as 'no value' and directive 'doc_root' as 'no value'.

     

    Does anyone have any ideas about what is wrong? I am a novice and amateur web programmer, so do not rule out my stupidity or ignorance.  I wonder if some architectural change to the way page requests are serviced might have broken my use of document-root-relative files.

    1 REPLY 1

    Re: PHP 5.6.30 can no longer access relative files outside of DOCUMENT_ROOT

    (And ... yes, I will upgrade PHP this month.)