PHP to obtain server information implementation code _php tips

Source: Internet
Author: User
Tags html form mysql version php server
Copy Code code as follows:

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> Get Server information </title>
<body>
<?php
$sysos = $_server["Server_software"]; To get a string of server identities
$sysversion = php_version; Get PHP Server version
The following two code connects the MySQL database and gets the MySQL database version information
mysql_connect ("localhost", "Mysql_user", "Mysql_pass");
$mysqlinfo = Mysql_get_server_info ();
Get information from the GD library from the server
if (function_exists ("Gd_info")) {
$GD = Gd_info ();
$gdinfo = $GD [' gd Version '];
}else {
$gdinfo = "Unknown";
}
See if FreeType fonts are supported from the GD library
$freetype = $GD ["FreeType Support"]? "Support": "Not supported";
Whether you can obtain remote file access from the PHP configuration file
$allowurl = Ini_get ("Allow_url_fopen")? "Support": "Not supported";
Get maximum upload limit from PHP configuration file
$max _upload = Ini_get ("File_uploads")? Ini_get ("Upload_max_filesize"): "Disabled";
Get the maximum execution time for a script from a PHP configuration file
$max _ex_time= ini_get ("Max_execution_time"). " Seconds ";
The following two gets the server time, the Chinese mainland uses is the East eight area time, sets the time zone to write etc/gmt-8
Date_default_timezone_set ("etc/gmt-8");
$systemtime = Date ("Y-m-d h:i:s", Time ());
/*  *******************************************************************  */
/* Export the above server information to the client browser as an HTML form.
/*  *******************************************************************  */
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 acquisition: </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>

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.