Check server compatibily with Magento

As discussed earlier in post “Magento System Requirements“, Magento has certain has certain server/software requirements which must be met in order to install and run it.

You can test your server for compatibility by following these simple steps:

  1. Download the magento-check file to your computer and unzip it. You can download the file from Magento or GitHub.
  2. Upload the extracted magento-check.php file to the web server directory where you will be installing Magento. In case you have already uploaded Magento files on your server then upload the magento-check.php file to the Magento directory.
  3. Open the magento-check.php file in your browser.
    If you will be installing Magento in the web root directory then you will need to browse the following URL http://mydomain.com/magento-check.php else if you have or will have it in a sub directory say “magento” then you will need to browse the following URL http://mydomain.com/magento/magento-check.php

Here is an image showing the results of magento-check.php run.

magento-check.php

The code from magento-check.php file is printed below. You can copy and save it in a file and upload the file to test your hosting environment.


<?
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', '<')) {
$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>';

}
}
?>

Leave a Comment

Back to top