PHP gets a piece of code for server information

Source: Internet
Author: User
Tags php server
  1. Get Server information
  2. $sysos = $_server["Server_software"]; Gets the string for the server identity
  3. $sysversion = php_version; Get PHP Server version

  4. The following two code connects to MySQL database and obtains MySQL database version information

  5. mysql_connect ("localhost", "Mysql_user", "Mysql_pass");
  6. $mysqlinfo = Mysql_get_server_info ();

  7. Get information about the GD library 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. See if FreeType fonts are supported from the GD library

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

  16. Get the remote file from the PHP configuration file

  17. $allowurl = Ini_get ("Allow_url_fopen")? "Support": "Not supported";

  18. Get maximum upload limit from PHP configuration file

  19. $max _upload = Ini_get ("File_uploads")? Ini_get ("Upload_max_filesize"): "Disabled";

  20. To get the maximum execution time of a script from a PHP configuration file

  21. $max _ex_time= ini_get ("Max_execution_time"). " Seconds ";

  22. The following two get server time, Mainland China is using the time of the East Eight, set the timezone to write etc/gmt-8

  23. Date_default_timezone_set ("etc/gmt-8");
  24. $systemtime = Date ("Y-m-d h:i:s", Time ());

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

  26. /* Output The server information obtained above to the client browser as an HTML table */
  27. /* ******************************************************************* */
  28. echo "
  29. echo "
  30. echo "
  31. echo "
  32. echo "
  33. echo "
  34. echo "
  35. echo "
  36. echo "
  37. echo "
  38. echo "
  39. echo "
  40. "; "; "; "; "; "; "; "; "; "; ";

    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
    Maximum execution time: $max _ex_time
    Server time: $systemtime
    ";
  41. ?>
Copy Code
  • 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.