Installing phpiredis on cPanel and CloudLinux

You may already be familiar with this message if customers have contacted you previously about messages from their Laravel installs

predis/predis suggests installing ext-phpiredis (Allows faster serialization and deserialization of the Redis protocol)

For anyone that uses Laravel you’re probably using the Redis for caching, but for optimal performance Laravel recommends the use of the phpiredis extension from github.com/nrk/phpiredis, which isn’t available on cPanel servers with CloudLinux, so here’s a way to install it so all your customers can benefit.

We’ll install it for PHP 7.3 on our CloudLinux server but the same process applies for all versions of the PHP Selector on CloudLinux.

First clone the Git repository of the extension, at the time of writing this extension isn’t on the PHP PECL website so we’ll have to get it from GitHub instead.

git clone https://github.com/nrk/phpiredis.git

Change directory to the extension folder.

cd phpiredis/

Run phpize on the source.

/opt/alt/php80/usr/bin/phpize

Configure the extension source.

./configure –with-php-config=/opt/alt/php80/usr/bin/php-config

Compile the extension.

make

Install the extension files.

make install

Create a new file for the extension information.

nano /opt/alt/php80//etc/php.d.all/phpiredis.ini

Add the following to the file so PHP Selector can enable it.

; Enable phpiredis extension module

extension=phpiredis.so

Rebuild Cage FS, to include the new extension.

cagefsctl –rebuild-alt-php-ini

Restart Apache to pick up your new extensions.

service httpd restart

At this point you can enable it for all your customers in WHM by going to the CloudLinux LVE Manager in WHM and enabling it for the 7.3 PHP version in the Selector tab, or allow your customers to select whether they want to use it in their cPanel account.

Published
Categorised as Linux

Leave a comment

Your email address will not be published. Required fields are marked *

Exit mobile version