#!/usr/bin/env php $databaseTypeFunction) { $dbtest = $databaseTypeName.' '; if (function_exists($databaseTypeFunction)) { $dbtest .= 'Passed'; $dbsupported++; } else { $dbtest .= 'Failed'; } echo $dbtest."\n"; } // db-state if ($dbsupported == 0) { $errors++; array_push($errorsMessages, "PHP-Database-Support : no supported database-type found."); } // OS-Specific // get os $osString = php_uname('s'); if (isset($osString)) { if (!(stristr($osString, 'linux') === false)) /* linux */ define('_OS', 1); else if (!(stristr($osString, 'bsd') === false)) /* bsd */ define('_OS', 2); else define('_OS', 0); } else { define('_OS', 0); } echo '5. OS-Specific ('.$osString.' '.php_uname('r').')'."\n"; switch (_OS) { case 1: // linux echo 'No Special Requirements on Linux-OS. Passed'."\n"; break; case 2: // bsd // posix $posix = 'posix '; if ((function_exists('posix_geteuid')) && (function_exists('posix_getpwuid'))) { $posix .= 'Passed'; } else { $posix .= 'Failed'; $warnings++; array_push($warningsMessages, "OS-Specific : PHP-extension posix missing. some netstat-features wont work without."); } echo $posix."\n"; break; case 0: // unknown default: echo "OS not supported.\n"; $errors++; array_push($errorsMessages, "OS-Specific : ".$osString." not supported."); break; } // summary echo '----- Summary -----'."\n"; // state $state = "State : "; if (($warnings + $errors) == 0) { // good $state .= 'Ok'."\n"; echo $state; echo _NAME." should run on this system.\n"; } else { if (($errors == 0) && ($warnings > 0)) { // may run with flaws $state .= 'Warning'."\n"; echo $state; echo _NAME." may run on this system, but there may be problems.\n"; } else { // not ok $state .= 'Failed'."\n"; echo $state; echo _NAME." cannot run on this system.\n"; } } // errors if (count($errorsMessages) > 0) { echo ('Errors :'."\n"); foreach ($errorsMessages as $errorsMessage) { echo " - ".$errorsMessage."\n"; } } // warnings if (count($warningsMessages) > 0) { echo ('Warnings :'."\n"); foreach ($warningsMessages as $warningsMessage) { echo " - ".$warningsMessage."\n"; } } // exit exit(); ?>