This post shows how you can simply extend Redis with a few usefull stuff. Those are required if you wanna get the most out of Object Cache Pro. Please note that I used PHP8.4 in that example!,
- Log in to your VPS with the main (root) user.,
- Make a backup of your instance.,
- Install the dev package for the PHP Version.,
apt update && apt -y install php8.4-dev
- Go to https://pecl.php.net/ and search for the extension redis.,
- Download the tgz via cURL (This command will get you the latest version):,
curl -O https://pecl.php.net/get/redis
- Extract the tgz (edit the command to fit the downloaded redis version):,
tar xf redis-xxx.tgz
- phpize the extension:,
cd redis-xxx
phpize8.4
- Before we compile and build the redis extension we need to install a few of the following things to make it work:,
sudo apt install liblz4-dev
git clone --recursive --depth=1 https://github.com/kjdev/php-ext-lz4.git
cd php-ext-lz4
./configure --with-php-config=/usr/bin/php-config8.4
make
make install
apt-get -y install libzstd-dev
curl -O https://pecl.php.net/get/igbinary
tar xf igbinary-xxx.tgz (Edit to fit the latest version's tgz file)
cd igbinary-xxx (Edit to fit the latest version's folder name)
phpize8.4
./configure --with-php-config=/usr/bin/php-config8.4
make
make install
-
After we installed the required extensions and packages we should edit the php.ini files at
/etc/php/8.4/cli/php.ini
and/etc/php/8.4/fpm/php.ini
to make sure we enabled the extensions.,
# THIS IS THE END OF THE PHP.INI FILE!
[ffi]
; FFI API restriction. Possible values:
; "preload" - enabled in CLI scripts and preloaded files (default)
; "false" - always disabled
; "true" - always enabled
;ffi.enable=preload
; List of headers files to preload, wildcard patterns allowed.
;ffi.preload=
imagick.skip_version_check=true
;zend_extension=ioncube_loader_lin_8.4.so
extension=memcached.so
extension=redis.so
extension=imagick.so
extension=lz4.so
extension=igbinary.so
- Now we should go back to redis's folder and do the installation.,
cd redis-xxx
./configure --with-php-config=/usr/bin/php-config8.4 --enable-redis-igbinary --enable-redis-lz4 --enable-redis-zstd --enable-redis-lzf --with-liblz4
make
make install
- Restart the PHP-FPM service:,
systemctl restart php8.4-fpm
- To check if the extension is loaded for FPM, you can check the phpinfo or the WordPress control panel since Object Cache Pro shows if we were successful.,
(edited)
- Συνδεθείτε για να δημοσιεύσετε σχόλια