PHP code to obtain server information

WBOY
Release: 2016-07-25 09:05:33
Original
1048 people have browsed it
  1. Get server information
  2. $sysos = $_SERVER["SERVER_SOFTWARE"]; //Get the string of server identification
  3. $sysversion = PHP_VERSION; //Get the PHP server version

  4. //The following two codes connect to the mysql database and obtain the MySQL database version information

  5. mysql_connect("localhost", "mysql_user", "mysql_pass");
  6. $mysqlinfo = mysql_get_server_info();

  7. //Get GD library information from the server

  8. if(function_exists("gd_info")){
  9. $gd = gd_info();
  10. $gdinfo = $gd ['GD Version'];
  11. }else {
  12. $gdinfo = "Unknown";
  13. }

  14. //Check whether FreeType fonts are supported from the GD library

  15. $freetype = $gd[" FreeType Support"] ? "Support" : "Not supported";

  16. //Whether it is possible to obtain remote files from the PHP configuration file

  17. $allowurl= ini_get("allow_url_fopen") ? "Support " : "Not supported";

  18. //Get the maximum upload limit from the PHP configuration file

  19. $max_upload = ini_get("file_uploads") ? ini_get("upload_max_filesize") : "Disabled";

  20. //Get the maximum execution time of the script from the PHP configuration file

  21. $max_ex_time= ini_get("max_execution_time")."seconds";

  22. // 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

  23. date_default_timezone_set("Etc/GMT-8");
  24. $systemtime = date("Y-m-d H:i: s",time());

  25. /* ****************************** ************************************* */

  26. /* Obtain the above in the form of HTML table The received server information is output to the client browser */
  27. /* ************************************* ************************************ */
  28. echo " ";
  29. echo "
  30. ";
  31. echo "
  32. ";
  33. echo "
  34. " ;
  35. echo "
  36. ";
  37. echo "
  38. ";
  39. echo "
  40. ";
  41. echo "
  42. ";
  43. echo "
  44. ";
  45. echo "
  46. ";
  47. echo "
  48. ";
  49. echo "
  50. System Information

    Web server: $sysos
    PHP version: $sysversion
    MySQL version: $mysqlinfo
    GD Library version: $gdinfo
    FreeType: $freetype
    Remote file acquisition: $allowurl
    Maximum upload limit: $max_upload
    Max Execution time: $max_ex_time
    Server time: $ systemtime
    ";
  51. ?>
Copy code


source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template