This is due to the error in the code.Enable error reporting and see what happens.
This code will help you-
ini_set('display_errors', '1');
error_reporting(E_ALL ^ E_NOTICE);
Read more- http://pcsupport.about.com/od/findbyerrormessage/a/500servererror.htm
4
solved Server error 500 [closed]