Last active
April 25, 2023 00:10
-
-
Save sonnygauran/21070ab064d6efad9d18 to your computer and use it in GitHub Desktop.
Magento System Requirements Check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Updated the "HOW DO I KNOW IF MY SERVER MEETS THESE SYSTEM REQUIREMENTS" | |
// from http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-is-compatible-with-magento | |
// specified at http://magento.com/resources/system-requirements | |
// | |
// minor adjustments made from original script | |
// http://www.magentocommerce.com/_media/magento-check.zip | |
extension_check(array( | |
'curl', | |
'dom', | |
'gd', | |
'hash', | |
'iconv', | |
'mcrypt', | |
'pcre', | |
'pdo', | |
'pdo_mysql', | |
'simplexml', | |
'soap' | |
)); | |
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 '.phpversion().'</strong> (min. 5.2.0)</li>'; | |
} | |
if(!ini_get('safe_mode')) { | |
$pass .='<li>Safe Mode is <strong>off</strong></li>'; | |
$version = mysql_get_server_info(); | |
if(version_compare($version, '4.1.20', '<')) { | |
$fail .= '<li>You need<strong> MySQL 4.1.20</strong> (or greater)</li>'; | |
} | |
else { | |
$pass .='<li>You have<strong> MySQL '.$version.'</strong> (min. 4.1.20)</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>'; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment