3

My webpage is putting out a 500 Internal Server Error. I've turned on E_ALL for error reporting in the php.ini, and restarted the httpd. I've even used error_reporting(E_ALL) and error_reporting(-1) but still no luck. Any suggestions?

OS: CentOS5.5
PHP: 5.2.6
HTTPD:  Apache/2.2.3
2
  • 2
    Might get better answers asking this over at ServerFault: serverfault.com This is more up their ally than SO's. Commented May 18, 2010 at 3:34
  • Perhaps you're right, simply wanted to check here, as it seems to be a problem with PHP. If you guys vote to migrate, so will I (= Commented May 18, 2010 at 3:41

6 Answers 6

1

The following testscript also won't generate any error messages/logs.

<?php
header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error');
echo 'Something went gaga';
?>

However the access_log will show the "500" response code (assuming apache's default access_log settings).

Search the code for "HTTP/1.1 500", "500" or "header(" and add:

trigger_error('Peep', E_USER_NOTICE);  // or error_log()

This will generate an entry in the errorlog (with filename and line-numbers)

Sign up to request clarification or add additional context in comments.

Comments

0

Check for error_log in your document root, and/or ask your server's support team where errors are logged (both Apache and PHP).

1 Comment

Can't find the error log. I have access to root, how would I find out the locations?
0

a 500 Internal Server Error is usually caused by a problem in your Apache config files. It usually doesn't have anything to do with your actual PHP script. For example your .htaccess file. Check your server logs, and if you can, post the errors listed there here as part of your question so we can better assess what your exact problem might be.

1 Comment

Actually, PHP will output an internal server error if error reporting is off.
0

Check the display_errors directive in your php.ini file. It may be set to 'Off' which will disable ALL error reporting.

Comments

0

CentOS you say... your error log is probably in /var/log/httpd/

Try tail -f /var/log/httpd/error_log in the command line and check for any errors

1 Comment

Nothing related to the script or PHP.
0

Put this on top of your script:

ini_set('display_errors', true);
error_reporting(E_ALL);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.