1

I have an Apach Http Server that started to fail for one of its virtual hosts with a 500 error. I went straight to the logs, triggered the problem and the result was a normal entry in the access log and no mention in the error logs.

This is running PHP so I run

php index.php

on the directory of the app and it run just fine. It's not a PHP problem, or rather, it's unlikely.

I set LogLevel to debug and what I see in the error logs is just this:

[Sat Jul 04 08:41:10 2009] [error] [client 84.72.21.12] File does not exist: /var/www/example.com/public/favicon.ico, referer: http://example.com/

and in the access log:

84.72.21.12 - - [04/Jul/2009:08:40:29 -0400] "GET / HTTP/1.1" 500 - "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.18 (KHTML, like Gecko) Version/4.0.1 Safari/530.18"
84.72.21.12 - - [04/Jul/2009:08:40:29 -0400] "GET /favicon.ico HTTP/1.1" 404 361 "http://example.com/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.18 (KHTML, like Gecko) Version/4.0.1 Safari/530.18"

Any ideas what else to try?

  • 3
    Is there an entry in the error log? – theotherreceive Jul 4 '09 at 4:03
  • Restart Apache (or the whole computer) maybe... if that doesn't fix it, we need more information. How did you trigger the problem? What is the line from the access log? Is the LogLevel set at debug, and once it is, what's in the error log? In a pinch, try running Apache from a terminal in debug mode (something like "apache2 -X -e debug") and see if anything gets printed to stderr. – David Z Jul 4 '09 at 4:52
  • As you mentioned there is no mention in the error logs, but try setting your LogLevel to debug and see if you can find anything. If not, we will need more information. – Ehtyar Jul 4 '09 at 5:00
  • @theotherreceive as I said, no, no errors. – pupeno Jul 4 '09 at 12:33
1

Make sure there is no .htaccess file in the folder path up to php file. That is if path is /var/www/html/a/b/test.php. Make sure there is no .htacces file in either /var/www/html, /var/www/html/a, /var/www/html/a/b folders. If there are .htaccess files, then rename them to something else and try again.

Most of the time I get 500 errors due to bad .htaccess file and since then do not show on simple 'ls', it is hard to understand that they are the source of problem.

1

It was a PHP error. Enabling display of PHP errors showed that and the reason why I didn't saw it when I was running the script manually is because I was running it as root and the error was lack of permission to write temporary data in a directory.

0

Are you invoking PHP through libapache2-mod-php (mod_php) or through something like FastCGI? Please can you let us know the versions you have installed, your distribution, check the file/directory permissions and try;

tail -f /var/log/apache2/access.log /var/log/apache2/error.log

Or alter to suit if your logs are in a different location. Then try hitting the site with your browser, also what do you get from putting together 'test.php' with:

<?php
  phpinfo();
?>

Does it display a page properly?

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.