How to solve Magento 500 internal server errors

Many users encounter some weird Magento 500 Internal Server Errors (Error type 500). I will try to list the most common solutions. These errors are not always caused by the same reason. You should try to take a look at your server’s error logs to get some help about this error.You can get additional info about the errors by Turning on Developer Mode.  Look in the Magento bootstrap file (index.php), you’ll see lines similar to the following

#ini_set(‘display_errors’, 1);  

Uncomment these. In a production system, you’d never want to have your errors display to the browser, but while developing having an errors and warnings thrown immediately in your face is invaluable.  This way, you will see the actually problem which lead to the Internal Error Server. In almost cases, the reason is that there is an exception throw after output is sent to browser.

Solution #1

This error might be caused because you have not set the correct permissions for the magento folders. To solve this go to File Manager and then change the file permission of index.php file from 664 to 644.  Also change the permissions of downloader/index.php file to 644 as well otherwise when you will try to access System > Magento Connect >Magento Connect Manager (after magento installation) by logging to magento admin,  you will get 500 Internal Server Error.

You can also try this tool, it’s a magento cleanup utility. It will set the correct permissions for your complete magento installation:

    Download itUnzip magento-cleanup.php to the root directory of your magento installationBrowse to
## Function to set file permissions to 0644 and folder permissions to 0755  
function AllDirChmod( $dir = "./", $dirModes = 0755, $fileModes = 0644 ){  
   $d = new RecursiveDirectoryIterator( $dir );  
   foreach( new RecursiveIteratorIterator( $d, 1 ) as $path ){  
      if( $path->isDir() ) chmod( $path, $dirModes );  
      else if( is_file( $path ) ) chmod( $path, $fileModes );  
## Function to clean out the contents of specified directory  
function cleandir($dir) {  
    if ($handle = opendir($dir)) {  
        while (false !== ($file = readdir($handle))) {  
            if ($file != '.' && $file != '..' && is_file($dir.'/'.$file)) {  
                if (unlink($dir.'/'.$file)) { }  
                else { echo $dir . '/' . $file . ' (file) NOT deleted!<br />'; }  
            else if ($file != '.' && $file != '..' && is_dir($dir.'/'.$file)) {  
                if (rmdir($dir.'/'.$file)) { }  
                else { echo $dir . '/' . $file . ' (directory) NOT deleted!<br />'; }  
function isDirEmpty($dir){  
     return (($files = @scandir($dir)) && count($files) <= 2);  
echo "----------------------- CLEANUP START -------------------------<br/>";  
$start = (float) array_sum(explode(' ',microtime()));  
echo "<br/>*************** SETTING PERMISSIONS ***************<br/>";  
echo "Setting all folder permissions to 755<br/>";  
echo "Setting all file permissions to 644<br/>";  
AllDirChmod( "." );  
echo "Setting pear permissions to 550<br/>";  
chmod("pear", 550);  
echo "<br/>****************** CLEARING CACHE ******************<br/>";  
if (file_exists("var/cache")) {  
    echo "Clearing var/cache<br/>";  
if (file_exists("var/session")) {  
    echo "Clearing var/session<br/>";  
if (file_exists("var/minifycache")) {  
    echo "Clearing var/minifycache<br/>";  
if (file_exists("downloader/pearlib/cache")) {  
    echo "Clearing downloader/pearlib/cache<br/>";  
if (file_exists("downloader/pearlib/download")) {  
    echo "Clearing downloader/pearlib/download<br/>";  
if (file_exists("downloader/pearlib/pear.ini")) {  
    echo "Removing downloader/pearlib/pear.ini<br/>";  
    unlink ("downloader/pearlib/pear.ini");  
echo "<br/>************** CHECKING FOR EXTENSIONS ***********<br/>";  
If (!isDirEmpty("app/code/local/")) {   
    echo "-= WARNING =- Overrides or extensions exist in the app/code/local folder<br/>";  
If (!isDirEmpty("app/code/community/")) {   
    echo "-= WARNING =- Overrides or extensions exist in the app/code/community folder<br/>";  
$end = (float) array_sum(explode(' ',microtime()));  
echo "<br/>------------------- CLEANUP COMPLETED in:". sprintf("%.4f", ($end-$start))." seconds ------------------<br/>";  

Solution #2
Your server does not support some of the magento specifications. You can easily test this using the magento check utility. Follow the steps below to check your server’s software, if there is an incompatibility this utility will show it.

Download it
Unzip magento-check.php to the root directory of your magento installation
Browse to

function extension_check($extensions) {  
    $fail = '';  
    $pass = '';  
    if(version_compare(phpversion(), '5.2.0', '<')) {  
        $fail .= '<li>You need<strong> PHP 5.2.0</strong> (or greater)</li>';  
    else {  
        $pass .='<li>You have<strong> PHP 5.2.0</strong> (or greater)</li>';  
    if(!ini_get('safe_mode')) {  
        $pass .='<li>Safe Mode is <strong>off</strong></li>';  
        preg_match('/[0-9]\.[0-9]+\.[0-9]+/', shell_exec('mysql -V'), $version);  
        if(version_compare($version[0], '4.1.20', '<')) {  
            $fail .= '<li>You need<strong> MySQL 4.1.20</strong> (or greater)</li>';  
        else {  
            $pass .='<li>You have<strong> MySQL 4.1.20</strong> (or greater)</li>';  
    else { $fail .= '<li>Safe Mode is <strong>on</strong></li>';  }  
    foreach($extensions as $extension) {  
        if(!extension_loaded($extension)) {  
            $fail .= '<li> You are missing the <strong>'.$extension.'</strong> extension</li>';  
        else{   $pass .= '<li>You have the <strong>'.$extension.'</strong> extension</li>';  
    if($fail) {  
        echo '<p><strong>Your server does not meet the following requirements in order to install Magento.</strong>';  
        echo '<br>The following requirements failed, please contact your hosting provider in order to receive assistance with meeting the system requirements for Magento:';  
        echo '<ul>'.$fail.'</ul></p>';  
        echo 'The following requirements were successfully met:';  
        echo '<ul>'.$pass.'</ul>';  
    } else {  
        echo '<p><strong>Congratulations!</strong> Your server meets the requirements for Magento.</p>';  
        echo '<ul>'.$pass.'</ul>';  

Solution #3
If you are getting weird 500 internal server errors on specific pages of your site, it might be a matter of resources. I was getting internal server erros on some product pages and on the I found out that the .htacess file of my magento installation was somehow reset and the php_value memory_limit value was set to 32M as soon as I raised it, the internal server errors vanished! You should use at least 256M for over 600-700 SKUs. Magento is very resource hungry and it is easy to get these kind of errors if you try to save some bucks from the hosting.

Solution #4
Htaccess file which is located at Magento root folder. It will be this case if you meet Internal Server Error on every page. Try to remove it for testing purpose
If your website was running file for a long time, then it must be a change at Server side, just submit a ticket to Hosting Company.

Solution #5 (Comment from Huberto)
If the curl extension is missing you can get 500 Internal server error. You can install it using the command below:

apt-get install curl libcurl3 libcurl3-dev php5-curl  


Read More: