Generally 500 internal server error is normal message when there is no message left to show. A number of reasons which can cause this message to display. Let’s explore what are the different problem and how to tackle them.

Check the Error Logs for Internal Server Error!

Firstly checkout the Apache and PHP logs file on your server. Because there are broad descriptions which will explain what is the cause of internal server error in PHP and Apache. The log file will provide broad description of your error lead you why your site fails. For information on where to find the logs for your server, please see: Where are the access_log and error_log for my server?

Error with an .htaccess file

If you are using a .htaccess on your site, it may be interfering with the web page you are trying to load into your browser. Please double check the .htaccess configuration. Any syntax errors will cause a 500 Internal Server Error message to be displayed instead of your website.
To confirm whether a misconfiguration .htaccess is the cause of the 500 Internal Server error, either remove or rename the .htaccess file temporarily and then try to reload the page.
See also:
Using .htaccess rewrite rules
Using .htaccess files

PHP Coding Timing Out

May be your are writing a database connection or any script which may be connected with other servers or other pages. That also cause of time out connection because other side may not response or too many connection attempts show you 500 internal server error.
Code in a manner where you can handle timeout connection requests too.Connecting to other database and other server connections like RSS feed are also difficult to catch while run time. May be you get error and think it’s server error.
Remove External attachments of website and you will decrease the chances of you receiving a “500 Internal Server Error.”

Syntax or coding errors in your CGI/Perl script

Any of your page ends with extension .pl or .cgi, double check them may be they cause of producing error. For detailed troubleshooting tips, please see: Troubleshooting CGI/PERL scripts.

CGI Script Guidelines

  • While writing code of CGI script, use normal editor like notepad. you can also use sublime. Avoid using Wordpad by Windows. It doesn’t save files in pure ASCII text format.
  • Upload your CGI scripts in ASCII mode into the cgi-bin directory.
  • Set your CGI file permission to 755. Also do the same for the directories. Using an ftp transfer protocol to upload file set their permissions by right click and permission. See Using FTP and SFTP for more information.
  • Double-check that the Perl modules you require for your script is supported. For a list of the currently supported Perl modules, please click here.