How to get system information in PHP

Source: Internet
Author: User
Tags http request require root directory server port

$root = getenv (' Document_root '); Server Document root directory
$port = getenv (' Server_port '); Server port
$file = getenv (' Script_name '); Current execution file
$ua = getenv (' http_user_agent '); User UA
$method = getenv (' Request_method '); Request method
$protocol = getenv (' Server_protocol '); Transport protocol
Getmypid (),////returns the process ID number of the current PHP process, which does not require input parameters.
Get_current_user (),////returns the owner name of the current program, and the function does not require input parameters.

Copy Code code as follows:


Get system Type and version number: Php_uname () (Example: Windows NT COMPUTER 5.1 build 2600)
Get system type only: Php_uname (' s ') (or: Php_os, Example: Windows NT)
Get System version number only: Php_uname (' R ') (example: 5.1)
Get PHP run by: php_sapi_name () (PHP run Mode:apache2handler)
Get previous process user name: get_ Current_User ()
Get PHP Version: Php_version
Get Zend version: Zend_version ()
Get PHP installation path: Default_include_path
Get the current file absolute path: __file__
Get HOST value in HTTP request: $_server["Http_host" (return value is domain name or IP)
Get server Ip:gethostbyname ($_server[' Server_Name '])
Accept the requested server IP: $_server["server_addr"] (sometimes not available, recommended: gethostbyname ($_server[' server_name '))
Get client IP: $_server[' remote_addr '
Get server Interpreter engine: $_server[' server_software ']
Get server CPU number: $_server[' processor_ IDENTIFIER ']
Get Server system directory: $_server[' SystemRoot ']
Get server domain name: $_server[' server_name ' (Recommended: $_server["Http_host"]
Get user domain name: $_server[' UserDomain ']
Get server language: $_server[' http_accept_language '
Get Server Web port: $_server[' Server_ PORT ']

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.