Install and Manage PHP Modules on CentOS

Provides a tutorial example on how to search and install additional PHP modules on CentOS 8 systems using 'dnf/yum' as the package manager.

If you are developing a Web application using PHP scripts, you may need to install additional PHP modules as shown in this tutorial.

1. Install php-json package, if you see the "Call to undefined function json_decode()" error:

herong$ test-script.php
Call to undefined function json_decode()

herong$ sudo yum search php | grep json
php-json.x86_64 : JavaScript Object Notation extension for PHP
...

herong$ sudo dnf install php-json
...
Installed:
  php-json-7.2.11-2.module_el8.1.0+209+03b9a8ff.x86_64

Complete!

2. Install php-mbstring package, if you see the "Call to undefined function mb_internal_encoding()" error:

herong$ test-script.php
Call to undefined function mb_internal_encoding()

herong$ sudo yum search php | grep mb
php-embedded.x86_64 : PHP library for embedding in applications
php-mbstring.x86_64 : A module for PHP applications which need
   multi-byte string

herong$ sudo dnf install php-mbstring
...
Installed:
  php-mbstring-7.2.11-2.module_el8.1.0+209+03b9a8ff.x86_64

Complete!

3. Install php-mysqlnd package, if you see the "Call to undefined function mysqli_connect()" error:

herong$ test-script.php
Call to undefined function mysqli_connect

herong$ sudo yum search php | grep mysql
php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases

herong$ sudo dnf install php-mysqlnd

Installed:
  php-mysqlnd-7.2.11-2.module_el8.1.0+209+03b9a8ff.x86_64
  php-pdo-7.2.11-2.module_el8.1.0+209+03b9a8ff.x86_64

Complete!

If you see more errors on undefined functions, you can continue to search and install additional PHP modules with the "yum" command.

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