Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
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. –  J. Pablo Fernández Jul 4 '09 at 12:33

3 Answers 3

up vote 1 down vote accepted

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.

share|improve this answer
    
Could you please share with us how you exactly enabled the displaying of the PHP errors and where they showed up? –  Flow Apr 13 '11 at 9:04
    
@Flow, I don't remember exactly, thankfully, I don't work much with PHP. Here's the relevant documentation I believe: php.net/manual/en/errorfunc.configuration.php –  J. Pablo Fernández Apr 13 '11 at 12:51
    
beware that if code uses @ to suppress errors per-line, no change to php.ini can help you. see the Big Red Warning at php.net/manual/en/language.operators.errorcontrol.php –  rymo Jun 21 '12 at 6:26

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.

share|improve this answer
    
Thanks, no .htaccess there. –  J. Pablo Fernández Jul 4 '09 at 12:58

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?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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