Magento Basic Requirements Check

Magento Basic Requirements Check

The following code can help us to check whether our system meets the basic requirements for magento installation or not. To use this code copy and paste it into a file with .php extension and put the file in the root directory of your server and run it from there. The same file can be downloaded from magento website.

extension_check(array( 
    'curl',
    'dom', 
    'gd', 
    'hash',
    'iconv',
    'mcrypt',
    'pcre', 
    'pdo', 
    'pdo_mysql', 
    'simplexml'
));

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