Skip to main content

How to install PHP pecl redis extension on cPanel with PHP 5.6 / PHP 7.0

Redis is a server that provides a key/value store. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries.You can find more details about Redis on the Redis website.  To interact with the Redis server from your PHP scripts (client-server communication), you need to install PHP pecl Redis extension.

Install PHP pecl redis extension on cPanel with PHP 5.6/PHP 7.0

In this article I will show you how to install PHP pecl redis extension on cPanel 58 with PHP 5.6/ PHP 7.0. So, I believe you have already setup your Redis server. If not, please refer the following link to download and setup the Redis server.

Here, I am installing the Redis PHP PECL extension on a cPanel 58 server with EasyApache 4.

You can directly install Redis PHP PECL module from “WHM >> Software >> Module Installers” page for PHP 7.0.

Selection_014

 

However, if you try to install the Redis PHP PECL extension 3.0 on the server for PHP 5.6, the following error will pop up.

pecl/redis requires PHP (version >= 7.0.0, version <= 7.1.0, excluded versions: 6.0.0), installed version is 5.6.25
No valid packages found
install failed

It says you require atleast PHP 7.0 for installing Redis PHP pecl 3.0 extension.

So, the solution is to manually compile and install an older version of PECL redis extension using phpize command. Please follow the steps given below to achieve this.

cd /usr/local/src/
wget  https://pecl.php.net/get/redis-2.2.8.tgz
tar zxpf redis*
cd redis*
/opt/cpanel/ea-php56/root/usr/bin/phpize   
./configure --with-php-config=/opt/cpanel/ea-php56/root/usr/bin/php-config
make
make install

Once the installation went well, please don’t forget to add the following line to the PHP 5.6 php.ini configuration.

extension=redis.so

This will load Redis extension on your server. You can verify it using the command given below.

php -m | grep -i redis

It will show the redis extension. That’s it. We are done.

If you face any issues during the setup, please feel free to mail me or leave a comment below.

How to install PHP pecl redis extension on cPanel with PHP 5.6 / PHP 7.0
5 (100%) 3 votes

GeeksAlive

TheGeeksAlive is all about Linux, Server Administration, Web Hosting and other Open Source Technologies.

  • When running phpize I get command not found.

    It is an almost fresh install of cPanel (just CSF/LFD and custom backup script added).

    What do I do?

    • OK, phpize should be:

      /opt/cpanel/ea-php56/root/usr/bin/phpize

      However, make command still results in error:

      make: *** No targets specified and no makefile found. Stop.

      Do you know how to solve it?

      Thanks!

      • Good to see that you have found the solution for phpize. Edited the post accordingly. Regarding the error “make: *** No targets specified and no makefile found. Stop.”, it happens when you did not execute the ./configure command. Once you execute “./configure”, please check and make sure that the file “Makefile” is created under the folder.

        • See my other reply.

          One must run ./configure exactly as I illustrated. Otherwise it won’t be possible to be successful.

          • Yes, the configure command has to be specific. Once the ./configure went well, you will be able to execute “make”.
            Thanks for letting me know that the issue resolved.

    • Before make one must run:

      ./configure –with-php-config=/opt/cpanel/ea-php56/root/usr/bin/php-config