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, for more information about how to use PHP to obtain server information, see the following example. 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.