Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

How To Check If Your Host Supports Magento

Last modified by JLHC on Thu, October 2, 2008 06:12
Source|Old Revisions  |  Back To Group

Here’s a PHP script you can upload to your website that will check if your host meets the server requirements for Magento.

Simply copy and paste the code below and save it as magento-check.php. Upload it to your website and then open it up in your browser.

If your host fails to meet the requirements for Magento, it will tell you what is missing.

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

function extension_check($extensions) {
    $fail = '';
    
    if(version_compare(phpversion(), '5.2.0', '<')) {
        $fail .= '<li>PHP 5.2.0 (or greater)</li>';
    }
    
    if(!ini_get('safe_mode')) {
        if(preg_match('/[0-9].[0-9]+.[0-9]+/', shell_exec('mysql -V'), $version)) {
            if(version_compare($version[0], '4.1.20', '<')) {
                $fail .= '<li>MySQL 4.1.20 (or greater)</li>';
            }
        }
    }
    
    foreach($extensions as $extension) {
        if(!extension_loaded($extension)) {
            $fail .= '<li>'.$extension.'</li>';
        }
    }
    
    if($fail) {
        echo '<p>Your server does not meet the requirements for Magento.';
        echo 'The following requirements failed:</p>';
        echo '<ul>'.$fail.'</ul>';
    } else {
        echo '<p>Congratulations! Your server meets the requirements for Magento.</p>';
    }
}
?>

Please note that if you see that MySQL is not compatible, it might not be the case as your hosting account may not have SSH access (magento-check.php pulls the MySQL version through SSH). The best way is to check this with your web hosting provider.




 

Popular Wiki Tags  |  View all

 module   routes   list   resource   data accessing   backend   api   action   mysql4   controller   getModel   php   model   eav   custom attributes 

Professional Services from the Magento Team

Professional Installation from the Magento Team

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
50167 users|611 users currently online|102325 forum posts