...

View Full Version : Troobleshooting 500 Internal Error



michaelespinosa
03-28-2009, 08:23 PM
Hi, I am trying to troobleshoot a php app that has a coupe of pages that throw 500 internal errors. Any best practices on how to do this or common problems that would cause this?

steelaz
03-28-2009, 08:35 PM
Check your error logs. If your site is hosted with cpanel, there's an icon for that.

michaelespinosa
03-29-2009, 12:09 AM
Nothing in the logs except what page the error was thrown on. There is no .htaccess files on the site either.

ShaneC
03-29-2009, 01:33 AM
To my knowledge PHP doesn't really cause 500 errors. It probably can happen, just in all the time I've been coding it it never has.

I've always had my problems with 500 errors when screwing with .htaccess. Alternatively, there could a problem in the php.ini if you have one, or if you did a PHP ini function in your script that could cause it as well.

RomanTaylor
03-29-2009, 06:31 AM
Very weird. PHP should not cause this error unless its related to the .htaccesss somehow.
Try renaming your .htaccess file to backup.htaccess and it might show the script error instead of showing you 500 error.

Inigoesdr
03-29-2009, 10:23 PM
500 errors can be caused my a module failing to load, or a configuration error(ie. missing/malformed php.ini). If you have configured this manually you need to check the server logs for more information, and if you are on a shared server you need to contact your host.

NancyJ
03-29-2009, 11:57 PM
I've seen this when PHP is running as CGI (eg. FastCGI) rather than an apache module but it did give further info in the error log. In this case the script ran properly but the server returned a 500 error (Premature end of script headers)

michaelespinosa
03-30-2009, 09:05 PM
Ok, thanks everybody for the help. It looks like it the error is coming from a malformed header. Here is the header


function sendMail($_firstname, $_lastname, $_email, $message) {
$headers = "From: My Site Name\n";
$headers .= "X-Mailer: PHP\n";
$subject = "Welcome to My site name";
$recipient = "$_firstname, $_lastname <$toEmail>";
$response = mail($recipient, "$subject", $message, $headers);
return $response;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum