Php implementation code for obtaining Server Information

Source: Internet
Author: User

Copy codeThe Code is as follows:
<Html>
<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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.