Php implementation code for obtaining server information

Source: Internet
Author: User
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" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo"
System Information
Web server: $ Sysos
PHP version: $ Sysversion
MySQL version: $ Mysqlinfo
GD Library version: $ Gdinfo
FreeType: $ Freetype
Remote File Retrieval: $ Allowurl
Maximum upload limit: $ Max_upload
Maximum execution time: $ Max_ex_time
Server Time: $ Systemtime
";
?>

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.