PHP code to obtain server information
Release: 2016-07-25 09:05:33
Original
1063 people have browsed it
-
-
- Get server information
-
- $sysos = $_SERVER["SERVER_SOFTWARE"]; //Get the string of server identification
- $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();
//Get 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 from the GD library
- $freetype = $gd[" FreeType Support"] ? "Support" : "Not supported";
//Whether it is possible to obtain remote files from the PHP configuration file
- $allowurl= ini_get("allow_url_fopen") ? "Support " : "Not supported";
//Get the maximum upload limit from the PHP configuration file
- $max_upload = ini_get("file_uploads") ? ini_get("upload_max_filesize") : "Disabled";
//Get the maximum execution time of the script from the PHP configuration file
- $max_ex_time= ini_get("max_execution_time")."seconds";
// The following two items are used to obtain the server time. Mainland China uses the time of the East Eighth District. The set time zone is written as Etc/GMT-8
- date_default_timezone_set("Etc/GMT-8");
- $systemtime = date("Y-m-d H:i: s",time());
/* ****************************** ************************************* */
- /* Obtain the above in the form of HTML table The received server information is output to the client browser */
- /* ************************************* ************************************ */
- 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 acquisition: | $allowurl | ";
- echo "
Maximum upload limit: | $max_upload | ";
- echo "
Max Execution time: | $max_ex_time | ";
- echo "
Server time: | $ systemtime | ";
- echo "
";
- ?>
-
Copy code
|
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31