: This article mainly introduces PHP to obtain details about the current server. if you are interested in the PHP Tutorial, refer to it. Recently, I am writing an enterprise-level CMS using PHP. I need PHP in the background to obtain the details of the current server and related system parameters. I have sorted them out and paste them here for future use.
Obtain the system type and version: php_uname () (for example, Windows nt computer 5.1 build 2600)
Obtain only the system type: php_uname ('s ') (or: PHP_ OS, for example, Windows NT)
Obtain only the system version: php_uname ('r') (for example, 5.1)
Obtain the PHP running method: php_sapi_name () (PHP run mode: apache2handler)
Get the previous process username: Get_Current_User ()
Get PHP version: PHP_VERSION
Get Zend version: Zend_Version ()
Obtain the PHP Installation Path: DEFAULT_INCLUDE_PATH
Obtain the absolute path of the current FILE: _ FILE __
Obtain the Host value in an Http request: $ _ SERVER ["HTTP_HOST"] (the returned value is a domain name or IP address)
Get server ip: GetHostByName ($ _ SERVER ['server _ name'])
IP address of the SERVER that receives the request: $ _ SERVER ["SERVER_ADDR"] (sometimes it cannot be obtained. recommended: GetHostByName ($ _ SERVER ['server _ name'])
Obtain the client IP address: $ _ SERVER ['remote _ ADDR ']
Obtain SERVER interpretation engine: $ _ SERVER ['server _ soft']
Obtain the number of SERVER CPUs: $ _ SERVER ['processor _ IDENTIFIER ']
Get the SERVER system directory: $ _ SERVER ['systemroot']
Obtain the SERVER domain NAME (host NAME): $ _ SERVER ['server _ name'] (recommended: $ _ SERVER ["HTTP_HOST"])
Get user domain name: $ _ SERVER ['userdomain ']
Obtain the SERVER language: $ _ SERVER ['http _ ACCEPT_LANGUAGE ']
Obtain the SERVER Web PORT: $ _ SERVER ['server _ port']
Get the name and version of the communication PROTOCOL on the request page: $ _ SERVER ['server _ protocol'] for example, "HTTP/1.0 ".
The above describes how to obtain the details of the current server in PHP, including the content, and hope to help those who are interested in the PHP Tutorial.