PHP method for obtaining Server Information

Source: Internet
Author: User
This article mainly introduces how PHP can obtain server information. It is a very practical technique to obtain server system version, PHP version, Apache version, and other information through a custom function, friends in need can

This article mainly introduces how PHP can obtain server information. It is a very practical technique to obtain server system version, PHP version, Apache version, and other information through a custom function, friends in need can

This example describes how PHP obtains server information. Share it with you for your reference.

The specific implementation method is as follows:

The Code is as follows:

/**
* Obtain system information
*
* @ Return array
*/
Function getSystemInfo ()
{
$ SystemInfo = array ();

// System
$ SystemInfo ['OS'] = PHP_ OS;

// PHP version
$ SystemInfo ['phpversion'] = PHP_VERSION;

// Apache version
$ SystemInfo ['apacheversion'] = apache_get_version ();

// ZEND version
$ SystemInfo ['zendversion'] = zend_version ();

// GD related
If (function_exists ('gd _ info '))
{
$ GdInfo = gd_info ();
$ SystemInfo ['gdsupport '] = true;
$ SystemInfo ['gdversion'] = $ gdInfo ['gd version'];
}
Else
{
$ SystemInfo ['gdsupport '] = false;
$ SystemInfo ['gdversion'] = '';
}

// Security Mode
$ SystemInfo ['safemode'] = ini_get ('safe _ mode ');

// Register global variables
$ SystemInfo ['registerglobals'] = ini_get ('register _ globals ');

// Enable magic reference
$ SystemInfo ['magicquotes '] = (function_exists ("get_magic_quotes_gpc") & get_magic_quotes_gpc ());

// Maximum size of uploaded files
$ SystemInfo ['maxuploadfile'] = ini_get ('upload _ max_filesize ');
// Maximum memory occupied by script running
$ SystemInfo ['memorylimit '] = get_cmd_var ("memory_limit ")? Get_cmd_var ("memory_limit "):'-';

Return $ systemInfo;
}

I hope this article will help you with PHP programming.

,
Related Article

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.