PHP Modules Tutorials - Herong's Tutorial Examples - v5.19, by Herong Yang
"php -i" - Display Configuration Information
This section provides a tutorial example on how to display configuration information from the PHP runtime environment using the 'php -i' command or the phpinfo() function.
If you want to know configuration information of the PHP runtime environment, you run the "php" command with the "-i" option. It will run the phpinfo() function to display the runtime environment information and configuration directives.
Here is an example on my Windows computer:
herong> /php/php -i phpinfo() PHP Version => 7.3.0 System => Windows NT Local 6.1 build 7601 (Windows 7 Professional ... Build Date => Dec 6 2018 01:48:44 Compiler => MSVC15 (Visual C++ 2017) Architecture => x64 Configure Command => cscript /nologo configure.js "--enable-snaps... Server API => Command Line Interface Virtual Directory Support => enabled Configuration File (php.ini) Path => C:\windows Loaded Configuration File => (none) Scan this dir for additional .ini files => (none) Additional .ini files parsed => (none) PHP API => 20180731 PHP Extension => 20180731 Zend Extension => 320180731 Zend Extension Build => API320180731,TS,VC15 PHP Extension Build => API20180731,TS,VC15 Debug Build => no Thread Safety => enabled Zend Signal Handling => disabled Zend Memory Manager => enabled Zend Multibyte Support => disabled IPv6 Support => enabled DTrace Support => disabled ...
Here is an example on my macOS computer:
herong$ php -i phpinfo() PHP Version => 5.6.30 System => Darwin MyMac.local 16.7.0 Darwin Kernel Version 16.7.0: ... Build Date => Oct 29 2017 20:13:12 Configure Command => '/Library/Caches/com.apple.xbs/Binaries/apache_... Server API => Command Line Interface Virtual Directory Support => disabled Configuration File (php.ini) Path => /etc Loaded Configuration File => /etc/php.ini Scan this dir for additional .ini files => (none) Additional .ini files parsed => (none) PHP API => 20131106 PHP Extension => 20131226 Zend Extension => 220131226 Zend Extension Build => API220131226,NTS PHP Extension Build => API20131226,NTS Debug Build => no Thread Safety => disabled Zend Signal Handling => disabled Zend Memory Manager => enabled Zend Multibyte Support => provided by mbstring IPv6 Support => enabled DTrace Support => disabled ...
After displaying the runtime generic information, the "php -i" command displays configuration directives of all loaded modules, including the "core" module. For each directive, it displays 2 values:
Here is an example on my macOS computer:
herong$ php -i ... Configuration ... calendar Calendar support => enabled Core PHP Version => 5.6.30 Directive => Local Value => Master Value allow_url_fopen => On => On allow_url_include => Off => Off always_populate_raw_post_data => 0 => 0 asp_tags => Off => Off auto_append_file => no value => no value auto_globals_jit => On => On ... mysqli MysqlI Support => enabled Client API library version => mysqlnd 5.0.11-dev - 20120503 - $Id$ Active Persistent Links => 0 Directive => Local Value => Master Value mysqli.allow_local_infile => On => On mysqli.allow_persistent => On => On mysqli.default_host => 127.0.0.1 => 127.0.0.1 mysqli.default_port => 3306 => 3306 mysqli.default_pw => test => test mysqli.default_socket => /var/mysql/mysql.sock => /var/mysql/mysql.sock mysqli.default_user => test => test mysqli.max_links => Unlimited => Unlimited mysqli.max_persistent => Unlimited => Unlimited mysqli.reconnect => Off => Off mysqli.rollback_on_cached_plink => Off => Off ...
If you are running PHP scripts on a Web server, you can call the phpinfo() function in a script to display the same information as the "php -i" command.
First write a simple script as shown below:
Upload the script to your Web server:
Then run the script using its URL (e.g. http://server.name/phpinfo.php) in a browser. You will see the same information as the "php -i" command.
Table of Contents
Introduction and Installation of PHP
Managing PHP Environment and Modules on macOS
Managing PHP Environment and Modules on CentOS
Manage Runtime Configuration Directives
►"php -i" - Display Configuration Information
php.ini - Configuration Directive File
Additional .ini Configuration Files
extension_dir - Module Library Location
"php -m" - Display Loaded Modules
get_extension_funcs() - Get Module Functions
dl() - Load Module Dynamically
DOM Module - Parsing HTML Documents
GD Module - Manipulating Images and Pictures
MySQLi Module - Accessing MySQL Server
OpenSSL Module - Cryptography and SSL/TLS Toolkit
PCRE Module - Perl Compatible Regular Expressions
SOAP Module - Creating and Calling Web Services
SOAP Module - Server Functions and Examples