PHP 'HTTP Error - 500 Internal Server Error' - How to handle it

PHP 'HTTP Error - 500 Internal Server Error' - How to handle it

PHP 500 Server Error:

“HTTP Error 500”
or “HTTP 500 internal server error” It means “something went wrong but cannot be described what is wrong”. while writing php scripts some mistakes are done by a programmer . since php is very aggressive and sensitive , even a single .(dot) or an extra / can mess up all. So we should be very careful in writing the scripts. 500 internal server error comes when there are fatal errors in php scripts and we have . enabled error displaying switched off. In that case some mistakes will hide from the eyes of a programmer and which becomes a serious problems afterwards and the visitor have to encounter the “internal server error”. It becomes A headache for the visitors when they often visit the page. If you do not have any mistake in your script and still this problem is arising then reasons may be following.

1. Error with .htaccess file:

Check your .htaccess file carefully. Errors in syntax can cause internal server error.

2. Php Code Time Out:

Every server has a time limit to run a PhP. If the time limit is set to be 30 seconds , is a very less time for executing the PHP script may cause this error.

3. Syntax Error in your CGI script:

If your page ends in.cgi that will generate this error. Take a look of your script and fix it.


Resolution of 500 internal server error:

If you set incorrect permission to the different directories and files then in this case this error arises. Permission are to be set for specific pages. Because if you give the full permission to every page then each visitor can edit or modify the pages, it will surely a worst thing for you. In some cases on a specific page if you have set the full permission 777 and still you are getting this problem, then change the permission this will somehow solve your problem.

Commands For Set Permission:


Use the following command to assign the right permission to the directories and files in public_html directory.

Syntax:


Cd Public_html

find . –type d exec chmod 755 {} \ ;

find . –type f exec chmod 644 {} \ ;

Sometimes there are incorrect directive in .htaccess file. So please backup .htaccess and rebuild it by enabling “error displaying”.
Author
Jaishree
Views
4,376
First release
Last update
Rating
0.00 star(s) 0 ratings
Top