How To Check If Your Host Supports Magento

Last modified by Crucial Web Host on Wed, December 31, 2008 11:02
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.

Important Note: Magento requires the MySQL innodb table type. This script does not check for the innodb table requirement. Please manually verify your MySQL database supports inoodb before moving ahead.

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.

  1. <?
  2. extension_check(array(
  3.     'curl',
  4.     'dom',
  5.     'gd',
  6.     'hash',
  7.     'iconv',
  8.     'mcrypt',
  9.     'pcre',
  10.     'pdo',
  11.     'pdo_mysql',
  12.     'simplexml'
  13. ));
  14.  
  15. function extension_check($extensions) {
  16.     $fail = '';
  17.    
  18.     if(version_compare(phpversion(), '5.2.0', '<')) {
  19.         $fail .= '<li>PHP 5.2.0 (or greater)</li>';
  20.     }
  21.    
  22.     if(!ini_get('safe_mode')) {
  23.         if(preg_match('/[0-9].[0-9]+.[0-9]+/', shell_exec('mysql -V'), $version)) {
  24.             if(version_compare($version[0], '4.1.20', '<')) {
  25.                 $fail .= '<li>MySQL 4.1.20 (or greater)</li>';
  26.             }
  27.         }
  28.     }
  29.    
  30.     foreach($extensions as $extension) {
  31.         if(!extension_loaded($extension)) {
  32.             $fail .= '<li>'.$extension.'</li>';
  33.         }
  34.     }
  35.    
  36.     if($fail) {
  37.         echo '<p>Your server does not meet the requirements for Magento.';
  38.         echo 'The following requirements failed:</p>';
  39.         echo '<ul>'.$fail.'</ul>';
  40.     } else {
  41.         echo '<p>Congratulations! Your server meets the requirements for Magento.</p>';
  42.     }
  43. }
  44. ?>

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 via a shell command). The best way is to check this with your web hosting provider.




 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs