Php obtains a piece of code for server information, including mysql database version information, GD database information, and php upload information. For more information, see
The code is as follows:
Obtain server information
$ 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"
";Echo"
System Information
";Echo"
Web server: |
$ Sysos |
";Echo"
PHP version: |
$ Sysversion |
";Echo"
MySQL version: |
$ Mysqlinfo |
";Echo"
GD Library version: |
$ Gdinfo |
";Echo"
FreeType: |
$ Freetype |
";Echo"
Remote File Retrieval: |
$ Allowurl |
";Echo"
Maximum upload limit: |
$ Max_upload |
";Echo"
Maximum execution time: |
$ Max_ex_time |
";Echo"
Server Time: |
$ Systemtime |
";Echo"
";
?>