Ok, i got it!!
Thank you all so much..
i just figured i'd give an A-to-Z summary of the procedure to enable Redis for one or more users in the
non-Pro version of Directadmin..
there are a few things you'll need to replace first:
replace USERNAME as appropriate
replace PASSWORD as appropriate
replace php74 as appropriate
replace /usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/ as appropriate (see below)
replace maxmemory 512MB as appropriate
replace maxmemory-samples 6 as appropriate
First, install the general components (you can just copy-paste into terminal):
Code:
cd /usr/local/directadmin/custombuild/build; \
.build set redis yes; \
.build redis; \
\
cd /usr/local/php74/bin; \
./pecl install igbinary igbinary-devel; \
./pecl install redis;
answer yes to the question:
"enable igbinary serializer support? [no] :"
Now, to find the path to the php extensions:
Code:
ll /usr/local/php74/lib/php/extensions;
For me, that was:
/usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/
you need to replace that with your own below..
Then run this to add the necessary PHP extensions in order to access Redis from PHP (like, for WordPress):
Code:
echo "extension=/usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/redis.so" >> /usr/local/php74/lib/php.conf.d/10-directadmin.ini; \
echo "extension=/usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/igbinary.so" >> /usr/local/php74/lib/php.conf.d/10-directadmin.ini; \
killall -9 lsphp;
(that last line is for LiteSpeed, i imagine for Apache PHP-FPM, it would be 'service php-fpm restart', and for Apache, it's probably 'service apache2 restart')
Now, to enable it for a given USERNAME (make sure to replace every instance of USERNAME, PASSWORD, etc.. with the correct values):
Code:
sudo -u USERNAME mkdir /home/USERNAME/.redis; \
chmod 770 /home/USERNAME/.redis; \
\
sudo -u USERNAME mkdir /home/USERNAME/.redis/db; \
chmod 770 /home/USERNAME/.redis/db; \
\
sudo -u USERNAME touch /home/USERNAME/.redis/redis.sock; \
chmod 770 /home/USERNAME/.redis/redis.sock; \
\
touch /usr/local/directadmin/data/users/USERNAME/redis.conf; \
chown diradmin.USERNAME /usr/local/directadmin/data/users/USERNAME/redis.conf; \
chmod 640 /usr/local/directadmin/data/users/USERNAME/redis.conf; \
\
{ echo "supervised systemd"; \
echo "port 0"; \
echo "unixsocket /home/USERNAME/.redis/redis.sock"; \
echo "unixsocketperm 770"; \
echo "requirepass PASSWORD"; \
echo "maxmemory 512MB"; \
echo "maxmemory-samples 6"; } > /usr/local/directadmin/data/users/USERNAME/redis.conf; \
\
systemctl daemon-reload; \
systemctl enable redis@USERNAME; \
systemctl start redis@USERNAME;
Finally, when it comes time to configure LiteSpeed Cache, or whatever PHP tool will be used to connect to Redis,
in the 'hostname' or 'IP address' field, you need to enter:
/home/USERNAME/.redis/redis.sock
You'll need to enter the password you provided in the config, and the port is 0