I have searched on google for a long time but it seems like nobody has even asked this question: What is blocking the direct access of error_log on Apache servers? Or is it even an Apache thing or this happens to all servers? (by direct accessing i mean something like http://www.myphpsite.com/error_log)

My observation:

  • I have checked .htaccess files, doesn't seem to be it.
  • I had some log files which didnt have the permission set up properly so users can just go to http://www.myphpsite.com/test.log to view it.
  • I created a file with no extension and i can access it directly just fine. (e.g. http://www.myphpsite.com/test)
  • I have tried to set the permission to error_log to 777 or 664, still can't access it
  • Check through whm for configs, no luck there.
  • I did a grep on the entire server looking for the key word error_log but got nothing useful.

So what is stopping the user from accessing error_log file and how do i change the setting?


On a Linux Server the default logging directory for Apache is /var/log/httpd (or /var/log/apache2 depending on your distribution) and the default Document root directory for the web files is /var/www/.

This means if everything is set up per default users shouldn't be able to access your error logs directly via http://url/etcetc quite simply because there's no log file there unless you're copying the log files over to the /var/www/ directory or if you've somehow included /var/log in your Document root directory in the apache configuration files.

Hope this provides an explination.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.