<html>
<head>
<title>The serverReporter function</title>
</head>

<body>

<pre name="code" class="php">
&#60;?php
 /* set required extensions */
 $my_required_extensions = array(
  &#39;gd&#39;,  //graphics library
  &#39;xml&#39;,  //xml
  &#39;mysql&#39;, //database
  &#39;curl&#39;,  //networking
  &#39;openssl&#39;, //site will need SSL
  &#39;pecl&#39;  //pear
 );
 natcasesort($my_required_extensions);
 
 //get loaded modules
 $loaded_extensions = get_loaded_extensions();
?&#62;

&#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Strict//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&#34;&#62;
&#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34; xml:lang=&#34;en&#34; lang=&#34;en&#34;&#62;
&#60;head&#62;

 &#60;title&#62;&#60;?php echo $source_article; ?&#62; Example&#60;/title&#62;
 &#60;meta name=&#34;description&#34; value=&#34;&#60;?php echo htmlentities($meta_description); ?&#62;&#34; /&#62;
 &#60;style type=&#34;text/css&#34;&#62;

  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; }
 &#60;/style&#62;
&#60;/head&#62;
&#60;body&#62;

&#60;h1&#62;&#60;?php echo $_SERVER[&#39;HTTP_HOST&#39;]; ?&#62;&#60;/h1&#62;

&#60;h2&#62;General Information&#60;/h2&#62;

&#60;p&#62;
 &#60;strong&#62;Server Software:&#60;/strong&#62;  &#60;?php echo $_SERVER[&#39;SERVER_SOFTWARE&#39;]; ?&#62;&#60;br /&#62;
 &#60;strong&#62;Document Root:&#60;/strong&#62; &#60;?php echo $_SERVER[&#39;DOCUMENT_ROOT&#39;]; ?&#62;&#60;br /&#62;

 &#60;strong&#62;PHP Version:&#60;/strong&#62; &#60;?php echo phpversion(); ?&#62;
&#60;/p&#62;

&#60;h2&#62;Extension Check&#60;/h2&#62;
&#60;?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 &#39;&#60;div class=&#34;found&#34;&#62;&#60;strong&#62;&#39;,$match,&#39;&#60;/strong&#62; found!&#60;/div&#62;&#39;; }
 foreach($missings as $miss) { echo &#39;&#60;div class=&#34;miss&#34;&#62;&#60;strong&#62;&#39;,$miss,&#39;&#60;/strong&#62; missing!&#60;/div&#62;&#39;; }
 foreach($loaded_extensions as $e) { if(!in_array($e,$matches) &#38;&#38; !in_array($e,$missings)) { echo &#39;&#60;div class=&#34;extra&#34;&#62;&#60;strong&#62;&#39;,$e,&#39;&#60;/strong&#62; is available.&#60;/div&#62;&#39;; } }
?&#62;&#60;br /&#62;

&#60;/body&#62;
&#60;/html&#62;
</pre>




</body>
</html>
