php to get the server information implementation code

  • 2020-05-27 04:35:34
  • OfStack

<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title> Get server information </title>
$sysos = $_SERVER["SERVER_SOFTWARE"];      // Gets the string for the server identity 
$sysversion = PHP_VERSION;                   // To obtain PHP Server version 
// The following two codes are joined MySQL Database and get MySQL Database version information 
mysql_connect("localhost", "mysql_user", "mysql_pass");
$mysqlinfo = mysql_get_server_info();
// Get it from the server GD Library information 
$gd = gd_info();
$gdinfo = $gd['GD Version'];
}else {
$gdinfo = " The unknown ";
// from GD Check the library to see if it is supported FreeType The font 
$freetype = $gd["FreeType Support"] ? " support " : " Does not support ";
// from PHP Gets whether a remote file can be retrieved from the configuration file 
$allowurl= ini_get("allow_url_fopen") ? " support " : " Does not support ";
// from PHP Get the maximum upload limit in the configuration file 
$max_upload = ini_get("file_uploads") ? ini_get("upload_max_filesize") : "Disabled";
// from PHP Get the maximum execution time of the script in the configuration file 
$max_ex_time= ini_get("max_execution_time")." seconds ";
// The following two server acquisition time, the Chinese mainland USES east 8 The time , Set the time zone as Etc/GMT-8
$systemtime = date("Y-m-d H:i:s",time());
/*  *******************************************************************  */
/*    In order to HTML In the form of a table, output the server information obtained above to the client browser           */
/*  *******************************************************************  */
echo "<table align=center cellspacing=0 cellpadding=0>";
echo "<caption> <h2>  System information   </h2> </caption>";
echo "<tr> <td> Web Server:     </td> <td> $sysos        </td> </tr>";
echo "<tr> <td> PHP Version:       </td> <td> $sysversion   </td> </tr>";
echo "<tr> <td> MySQL Version:     </td> <td> $mysqlinfo    </td> </tr>";
echo "<tr> <td> GD Library version:      </td> <td> $gdinfo       </td> </tr>";
echo "<tr> <td> FreeType :      </td> <td> $freetype     </td> </tr>";
echo "<tr> <td>  Remote file acquisition:  </td> <td> $allowurl     </td> </tr>";
echo "<tr> <td>  Maximum upload limit:  </td> <td> $max_upload   </td> </tr>";
echo "<tr> <td>  Maximum execution time:  </td> <td> $max_ex_time  </td> </tr>";
echo "<tr> <td>  Server time:    </td> <td> $systemtime   </td> </tr>";
echo "</table>";

Related articles: