"php -i" - Dump PHP Environment Information

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

 Cockpit - Web Portal for Administrator

 Process Management

 Files and Directories

 Users and Groups

 File Systems

 Block Devices and Partitions

 LVM (Logical Volume Manager)

 Installing CentOS

 SELinux - Security-Enhanced Linux

 Network Connection on CentOS

 Software Package Manager on CentOS - DNF and YUM

 Running Apache Web Server (httpd) 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 Web 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

 vsftpd - Very Secure FTP Daemon

 Postfix - Mail Transport Agent (MTA)

 Dovecot - IMAP and POP3 Server

 Email Client Tools - Mail User Agents (MUA)

 LDAP (Lightweight Directory Access Protocol)

 GCC - C/C++ Compiler

 Graphics Environments on Linux

 Conda - Environment and Package Manager

 Tools and Utilities

 Administrative Tasks

 References

 Full Version in PDF/EPUB