Site icon Fix I.T. Phill – Your Go-To Tech Guru

How to Install Essential PHP Extensions for WordPress Using WHM/cPanel (Including Exif, Fileinfo, Imagick, PHP-Intl, and More)

WHM/cPanel interface with PHP logos for Exif, Fileinfo, Imagick, PHP-Intl, and Memcached and Redis logos.

Installing PHP Extensions for WordPress Using WHM/cPanel.

As WordPress continues to evolve, it’s crucial to optimize your PHP environment with the correct extensions. As of September 2024, PHP 8.2 is the recommended version, with PHP 8.3 now available as the latest stable release. This guide covers how to install essential PHP extensions such as Exif, Fileinfo, Imagick, PHP-Intl, and also how to enhance your WordPress performance by integrating Memcached and Redis. We’ll also discuss the importance of keeping your server updated with the latest PHP versions and how to manage extensions per PHP version using EasyApache 4.


Table of Contents

  1. Prerequisites
  2. Essential PHP Extensions for WordPress
  3. Why PHP 8.2 or PHP 8.3 Should Be Your Target
  4. Installing PHP Extensions Using EasyApache 4
  5. Enhancing Performance with Memcached and Redis
  6. Installing PHP Extensions for Memcached and Redis
  7. Verifying Installed Extensions
  8. Common Issues and Troubleshooting
  9. Conclusion

1. Prerequisites

Ensure that you have the following before starting:


2. Essential PHP Extensions for WordPress

The following PHP extensions are recommended for optimal WordPress functionality:


3. Why PHP 8.2 or PHP 8.3 Should Be Your Target

As of September 2024, WordPress users should be running PHP 8.2 or considering an upgrade to PHP 8.3. Here’s why:

Staying updated with the latest PHP versions ensures better performance, security, and access to new features.

BranchInitial ReleaseActive Support UntilSecurity Support Until
8.125 Nov 202125 Nov 2023 (ended)25 Nov 2024
8.208 Dec 202208 Dec 202408 Dec 2025
8.323 Nov 202323 Nov 202523 Nov 2026

4. Installing PHP Extensions Using EasyApache 4

Using EasyApache 4 within WHM is the simplest method for installing and managing PHP extensions across different PHP versions. In EasyApache 4, extensions are installed per PHP version, so you’ll need to select the extensions for each version you are using. Here’s how to install key extensions like Exif, Fileinfo, Imagick, and PHP-Intl.

Step 1: Log in to WHM

Navigate to https://your-server-ip:2087/ and log in using your root credentials.

Step 2: Open EasyApache 4

Search for EasyApache 4 in the WHM dashboard and click on it.

Step 3: Customize PHP Extensions for PHP 8.2 or 8.3

Step 4: Install Required Extensions

For each PHP version (e.g., PHP 8.2, PHP 8.3) you are using, search for the following extensions and enable them by checking the corresponding boxes:

Step 5: Provision the Changes

After selecting the necessary extensions, click Review and then Provision to apply the changes. This will install the selected extensions for the specified PHP versions.


5. Enhancing Performance with Memcached and Redis

To further optimize your WordPress site, you can implement caching mechanisms like Memcached and Redis. These tools help reduce database load and improve site performance. Installing them requires additional PHP extensions.

For detailed installation guides, refer to:


6. Installing PHP Extensions for Memcached and Redis

To use Memcached and Redis with PHP, you need to install their respective PHP extensions for each PHP version you are using.

Installing PHP Memcached Extension

Step 1: Open EasyApache 4

Navigate to EasyApache 4 in WHM.

Step 2: Customize PHP Extensions
Step 3: Install Memcached Extension

For each PHP version (e.g., PHP 8.2, PHP 8.3), search for and enable:

Step 4: Provision the Changes

Click Review and then Provision to install the extension.

Installing PHP Redis Extension

Step 1: Open EasyApache 4

Again, go to EasyApache 4 in WHM.

Step 2: Customize PHP Extensions

Select PHP Extensions.

Step 3: Install Redis Extension

For each PHP version, search for and enable:

Step 4: Provision the Changes

Click Review and then Provision to install the extension.

Note on PECL Module Installer

If the extensions are not available in EasyApache 4, you can install them using the PECL module installer:

  1. Go to Module Installers in WHM.
  2. Click on Manage under PHP PECL.
  3. Select the PHP version.
  4. Install memcached or redis extensions.

7. Verifying Installed Extensions

To confirm the installation of the required PHP extensions, you can create a simple PHP info file.

Step 1: Create a PHP Info File

Run the following command to create a PHP file that outputs the currently installed extensions:

echo "<?php phpinfo();" | sudo tee /usr/local/apache/htdocs/info.php

Step 2: Access the PHP Info Page

Open a browser and navigate to http://your-server-ip/info.php. Scroll through the page and verify that the installed extensions, including Exif, Fileinfo, Imagick, PHP-Intl, Memcached, and Redis, are listed.

Step 3: Remove the PHP Info File

After verifying the installation, remove the PHP info file for security reasons:

sudo rm /usr/local/apache/htdocs/info.php

8. Common Issues and Troubleshooting

Issue 1: Extensions Not Appearing in PHP Info

Solution:

Issue 2: PECL Installation Fails

Solution:

  sudo dnf install php-pear

Issue 3: Imagick or GD Not Working for Image Processing

Solution:

Issue 4: PHP-Intl Not Working for Localization

Solution:

Issue 5: Memcached or Redis Not Working with PHP

Solution:


9. Conclusion

Installing and managing PHP extensions for WordPress via WHM/cPanel is crucial for optimal performance and compatibility, especially with PHP 8.2 and PHP 8.3 being the recommended versions as of September 2024. By using EasyApache 4, you can install necessary extensions like Exif, Fileinfo, Imagick, PHP-Intl, and more, per PHP version. Additionally, integrating caching solutions like Memcached and Redis can significantly enhance your site’s performance. Always verify the installation and troubleshoot any issues to ensure a smooth and secure WordPress experience.


Exit mobile version