"php -i" - Dump PHP Environment Information

This section provides a tutorial example on how to dump PHP environment information using the 'php -i' command. The output tells me where to go find different types of PHP program files.

The first thing you should do after installing the PHP package is probably to dump the PHP environment information using the "php -i" command, which actually calls the built-in phpinfo() function to do the job. Here is what I got on my CentOS 8 computer.

herong$ php -i

phpinfo()
PHP Version => 7.2.11

System => Linux 4.18.0-147.el8.x86_64 #1 SMP Wed Dec 4 21:51:45 UTC 2019
Build Date => Oct  9 2018 15:09:36
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 => /etc/php.d
Additional .ini files parsed => /etc/php.d/20-bz2.ini,
/etc/php.d/20-calendar.ini,
/etc/php.d/20-ctype.ini,
/etc/php.d/20-curl.ini,
/etc/php.d/20-exif.ini,
/etc/php.d/20-fileinfo.ini,
/etc/php.d/20-ftp.ini,
...

Core
PHP Version => 7.2.11
Directive => Local Value => Master Value
allow_url_fopen => On => On
allow_url_include => Off => Off
...
error_log => no value => no value
extension_dir => /usr/lib64/php/modules => /usr/lib64/php/modules

...

Now I know where to go find different types PHP program files:

centos$ which php
/usr/bin/php

centos$ ls -l /usr/bin/php
-rwxr-xr-x. 1 root root 5888640 Nov 13 23:09 /usr/bin/php

centos$ ls -l /etc/php.ini
-rw-r--r--. 1 root root 62221 Nov 13 23:09 /etc/php.ini

centos$ ls -l /etc/php.d
total 80
-rw-r--r--. 1 root root 44 Nov 13 23:09 20-bz2.ini
-rw-r--r--. 1 root root 54 Nov 13 23:09 20-calendar.ini
-rw-r--r--. 1 root root 48 Nov 13 23:09 20-ctype.ini
-rw-r--r--. 1 root root 46 Nov 13 23:09 20-curl.ini
...

centos$ ls -l /usr/lib64/php/modules/
total 8744
-rwxr-xr-x. 1 root root   34104 Nov 13 23:09 bz2.so
-rwxr-xr-x. 1 root root   55304 Nov 13 23:09 calendar.so
-rwxr-xr-x. 1 root root   18736 Nov 13 23:09 ctype.so
-rwxr-xr-x. 1 root root  113680 Nov 13 23:09 curl.so
...

Table of Contents

 About This Book

 Introduction to Linux Systems

 Process Management

 Files and Directories

 Running Apache HTTP Server (httpd) on Linux Systems

 Running Apache Tomcat on Linux Systems

Running PHP Scripts on Linux Systems

 Install and Manage PHP Packages on CentOS

"php -i" - Dump PHP Environment Information

 Install and Manage PHP Modules on CentOS

 Files Used in PHP "include" Statements

 Publish PHP Scripts on Apache HTTP Server

 Dump PHP/Apache Environment Information

 Change PHP Configuration Settings

 Apache PHP file_put_contents() Permission Denied

 SELinux Security Context on /var/www/html

 Migrate Old Scripts to New PHP Release

 Running MySQL Database Server on Linux Systems

 Running Python Scripts on Linux Systems

 Conda - Environment and Package Manager

 GCC - C/C++ Compiler

 OpenJDK - Open-Source JDK

 Graphics Environments on Linux

 SquirrelMail - Webmail in PHP

 Tools and Utilities

 References

 Full Version in PDF/EPUB