Ok, I found a way to fix this.
The problem:
- In aaPanel, when you install PHP 8.3, it installs a standard version (for things like CLI and Cron jobs). However, OpenLiteSpeed (OLS) uses its own specialized version of PHP called LSPHP (LiteSpeed PHP). Thus, when you clicked "Install Extension" in the aaPanel UI, the panel installed the Redis driver for the standard PHP 8.3, but it didn't correctly "inject" it into the LiteSpeed version of PHP 8.3.
- You can verify you are hitting the same issue by ssh-ing to your VM/aaPanel and paste this:
/usr/local/lsws/lsphp83/bin/php -m | grep redis. Should return redis.
Why Redis Object Cache plugin work, but LiteSpeed Cache doesn't?
- Redis Object Cache plugin uses a library called Predis. This is a bunch of PHP files that act as a "virtual" driver. It doesn't need the server to have anything special installed
- LiteSpeed Cache plugin is built for high performance. It refuses to use "virtual" drivers. It requires the PhpRedis Extension—a "C" driver compiled directly into the PHP engine.
Because that driver was missing from your LSPHP folder, LiteSpeed couldn't see it.
How to fix it?
- First, I uninstalled Redis extension from
aaPanel > App Store > PHP-8.3 > Install extensions > redis
NB: 8.3 is the PHP version I use for my WP website that is why I search for PHP-8.3)
- Then, I ssd to my VM/aaPanel and add the litespeedtech repo (rpms.litespeedtech.com/debian/lst_repo.gpg), which we need to install lsphp redis.
NB!: If you run the command down below as it is it wont work. You need to add "wget " before "-O". The forum isn't allowing me to put the whole line.
-O - http://rpms.litespeedtech.com/debian/lst_repo.gpg | sudo apt-key add -
sudo apt-get update
- And then run:
sudo apt-get install lsphp83-redis -y
Make sure 83 is the version of your website installation (mine is, so I run lsphp83). Haven't tried it, but I assume 84 is for php 8.4 and so on.
- Verify everything is correctly installed:
find /usr/local/lsws/lsphp83 -name "redis.so"
Should return something like /usr/local/lsws/lsphp83/lib/php/20230831/redis.so
- Good idea is to add in
aaPanel > App Store > PHP 8.3 > Configuration File at the very bottom: extension=redis.so
- Now if you go back to the
Install extensions you should see that you can Uninstall redis again - Dont do it.
- Then you can restart the php service
aaPanel > App Store > PHP 8.3 > Services > Restart and also from the very same SSH to the VM/aaPanel run this sudo killall -9 lsphp
Now everything should work.
PS: Make sure you have Redis extension installed and enabled from aaPanel > App Store > Redis
When you configure everything in your WP environment you can try running in your SSH of VM/aaPanel this redis-cli monitor. When you navigate in the website you should see long dumb list of things in the termninal.
PS2: Just spotted that aaPanel > App Store > Openlightspeed > Install extensions has redis extension. So you might try enabling it there, before proceeding with my guide.