PHP

ID #291

Why does my PHP script throw an Internal Server Error 500?

Applies to: Grid System

Internal Server Error 500 is usually caused by either a malformed cgi script or an invalid directive in an .htaccess file located either in the same directory as the page throwing an error, or in any directory above it.

If you have just uploaded or edited an .htaccess file that includes mod_php related directives such as php_value ..., php_flag ..., these are invalid because PHP runs here as a CGI, not as mod_php. This means that you either need to comment out those invalid PHP-related directives from the .htaccess file by putting a '#' symbol before them, or you need to place your PHP-related directives in an "IfModule" container so that they can be ignored on our system without throwing an error. For example:

# php_value magic_quotes_gpc off


php_value post_max_size 20971520
php_flag magic_quotes_gpc off

PHP-related configuration settings must be put in either your PHP configuration file, a php.ini file that is in the same directory as an executing script, or be set inside the script with ini_set() function calls.

Note that certain PHP settings cannot be set with ini_set() and can only be set on our system in a php.ini file. See the PHP manual on ini_set() for details.


Last update: 2010-10-04 14:44
Author: FAQ Admin
Revision: 1.2

Digg it! Share on Facebook Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 2.15 (20 Votes)

completely useless 1 2 3 4 5 most valuable

You can comment this FAQ

Comment of Anonymous:
Check also that your script isn't actually throwing fatal errors; these, in combination with some .htaccess redirect magic, may cause Apache to throw an error 500 instead of actually showing the output of the script.

If you think this might be happening to you, try renaming your .htaccess files to backup.htaccess and then accessing the script directly to see the real error.
Added at: 2008-09-02 11:18

Comment of Dave Duggan:
i found this error to be a failed hack attempt that screwed up index.php.
replaced index.php all ok.


Added at: 2010-09-20 09:17