Copy codeThe Code is as follows: <Head>
<Meta http-equiv = "content-type" content = "text/html; charset = gb2312">
<Title> obtain Server Information </title>
</Head>
<Body>
<? Php
$ Sysos = $ _ SERVER ["SERVER_SOFTWARE"]; // gets the string of the SERVER ID
$ Sysversion = PHP_VERSION; // get the PHP server version
// The following two codes connect to the MySQL database and obtain the MySQL database version information:
Mysql_connect ("localhost", "mysql_user", "mysql_pass ");
$ Mysqlinfo = mysql_get_server_info ();
// Obtain the GD library information from the server
If (function_exists ("gd_info ")){
$ Gd = gd_info ();
$ Gdinfo = $ gd ['gd version'];
} Else {
$ Gdinfo = "unknown ";
}
// Check whether FreeType fonts are supported in the GD library
$ Freetype = $ gd ["FreeType Support"]? "Supported": "Not Supported ";
// Obtain the remote file from the PHP configuration file
$ Allowurl = ini_get ("allow_url_fopen ")? "Supported": "Not Supported ";
// Obtain the maximum upload limit from the PHP configuration file
$ Max_upload = ini_get ("file_uploads ")? Ini_get ("upload_max_filesize"): "Disabled ";
// Obtain the maximum execution time of the script from the PHP configuration file
$ Max_ex_time = ini_get ("max_execution_time"). "seconds ";
// The following two get server time, the mainland China is the UTC + 8 time, set the time zone to write Etc/GMT-8
Date_default_timezone_set ("Etc/GMT-8 ");
$ Systemtime = date ("Y-m-d H: I: s", time ());
/*************************************** ******************************/
/* Output the server information obtained above to the client browser in the form of an HTML table */
/*************************************** ******************************/
Echo "<table align = center cellspacing = 0 cellpadding = 0> ";
Echo "<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 Retrieval: </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> ";
?>
<Body>
</Html>