Skip to content

500 Internal Server Error

2009 December 7
by Richard Knop

I have recently switched web hosting provider and had to move my personal website and blog over to the new one. I have encountered a simple problem when trying to get my personal website to work (it’s a Zend Framework application). I got the 500 Internal Server Error:

500 Internal Server Error

The problem lied in this .htaccess rule:

php_flag magic_quotes_gpc off

So I just commented the line and the error went away.

The line’s purpose was to make sure magic quotes are turned off in PHP.  You can use it if your web host supports it, if not just add this to your bootstrap file:

  1. protected function _initGetRidOfMagicQuotes()
  2. {
  3.     if (get_magic_quotes_gpc()) {
  4.         function stripslashes_deep($value) {
  5.             $value = is_array($value) ?
  6.             array_map('stripslashes_deep', $value) :
  7.             stripslashes($value);
  8.             return $value;
  9.         }
  10.  
  11.         $_POST = array_map('stripslashes_deep', $_POST);
  12.         $_GET = array_map('stripslashes_deep', $_GET);
  13.         $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
  14.         $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
  15.     }
  16. }
One Response leave one →
  1. July 12, 2011

    I had the same problem. but your solution doesn’t work form me. any idea?

    Thanks,

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS