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 Answers3

2

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.

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.

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?

ceinewydd
  • 884