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.
,