Revision: 6035
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 22, 2008 15:23 by iTony
Initial Code
<?php
/* set required extensions */
$my_required_extensions = array(
'gd', //graphics library
'xml', //xml
'mysql', //database
'curl', //networking
'openssl', //site will need SSL
'pecl' //pear
);
natcasesort($my_required_extensions);
//get loaded modules
$loaded_extensions = get_loaded_extensions();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php echo $source_article; ?> Example</title>
<meta name="description" value="<?php echo htmlentities($meta_description); ?>" />
<style type="text/css">
body { font-size:12px; }
h2 { border-bottom:1px solid #ccc; font-weight:normal; font-size:18px; margin-bottom:5px; padding-bottom:2px; }
p { line-height:20px; margin-top:0; }
.found { background:lightgreen; padding:5px 10px; margin:0 0 10px 0; }
.miss { background:pink; padding:5px 10px; margin:0 0 10px 0; }
.extra { background:lightblue; padding:5px 10px; margin:0 0 10px 0; }
</style>
</head>
<body>
<h1><?php echo $_SERVER['HTTP_HOST']; ?></h1>
<h2>General Information</h2>
<p>
<strong>Server Software:</strong> <?php echo $_SERVER['SERVER_SOFTWARE']; ?><br />
<strong>Document Root:</strong> <?php echo $_SERVER['DOCUMENT_ROOT']; ?><br />
<strong>PHP Version:</strong> <?php echo phpversion(); ?>
</p>
<h2>Extension Check</h2>
<?php
/* print out */
//analyze results
foreach($my_required_extensions as $ext)
{
if(in_array($ext,$loaded_extensions))
{
$matches[] = strtolower($ext);
}
else
{
$missings[] = strtolower($ext);
}
unset($loaded_extensions[$ext]);
}
//print out results
natcasesort($matches); natcasesort($missings); natcasesort($loaded_extensions);
foreach($matches as $match) { echo '<div class="found"><strong>',$match,'</strong> found!</div>'; }
foreach($missings as $miss) { echo '<div class="miss"><strong>',$miss,'</strong> missing!</div>'; }
foreach($loaded_extensions as $e) { if(!in_array($e,$matches) && !in_array($e,$missings)) { echo '<div class="extra"><strong>',$e,'</strong> is available.</div>'; } }
?><br />
</body>
</html>
Initial URL
http://blog.jeremymartin.name/2008/04/know-your-environment-php-server-module.html
Initial Description
Initial Title
Knowing a server php extensions
Initial Tags
php, server
Initial Language
PHP