How to Install and Configure phpRedis Extension for PHP 7.4 on Linux
This guide walks you through downloading, extracting, configuring, compiling, and installing the phpRedis C extension for PHP 7.4, shows how to enable it in php.ini, and provides commands to verify that the Redis extension is loaded correctly.
Introduction
phpredis is a PHP extension written in C that provides an API to communicate with a Redis key‑value store. It is released under the PHP License 3.01 and was originally developed by Owlient between November 2009 and March 2011. The source code is hosted at https://github.com/phpredis/phpredis.
Installation
Download
$ wget http://pecl.php.net/get/redis-5.3.2.tgz
# (example output showing download progress)Extract
$ tar -zxvf redis-5.3.2.tgz
# extracts package.xml, liblzf/LICENSE, etc.Generate configure script
$ /usr/local/php-7.4/bin/phpize
Configuring for:
PHP Api Version: 20190902
Zend Module Api No: 20190902
Zend Extension Api No: 320190902Configure
Locate the php-config binary and point the configure script to it:
$ sudo find / -name php-config
/usr/local/php-7.4/bin/php-config
$ ./configure --with-php-config=/usr/local/php-7.4/bin/php-configCompile
$ make -j4Install
$ sudo make install
Installing shared extensions: /usr/local/php-7.4/lib/php/extensions/no-debug-non-zts-20190902/Enable the extension
Add the following line to /usr/local/php-7.4/etc/php.ini:
extension=redis.soVerify installation
From the command line:
$ php -m | grep redis
redisOr by calling phpinfo() in a script and checking that the Redis section appears.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Tech Hub
Sharing cutting-edge internet technologies and practical AI resources.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
