predisHow can I install and configure Redis on an Ubuntu server running PHP?
-
Install Redis on Ubuntu server:
sudo apt-get install redis-serverThis will install Redis server on the server.
-
Configure Redis: Edit the Redis configuration file
/etc/redis/redis.confand set thebinddirective to the IP address of the server. -
Start Redis:
sudo service redis-server startThis will start the Redis server.
-
Test Redis:
redis-cli pingOutput:
PONG -
Install PHP Redis extension:
sudo apt-get install php-redisThis will install the Redis extension for PHP.
-
Configure PHP Redis extension: Edit the
php.inifile and add the lineextension=redis.so. -
Restart Apache:
sudo service apache2 restartThis will restart Apache and enable the Redis extension.
Helpful links
More of Predis
- How can I use PHP and Redis to retrieve data from a sorted set using ZRANGEBYSCORE?
- How can I troubleshoot a "PHP Redis went away" error?
- How do I install PHP, Redis, and XAMPP?
- How do I install and configure a PHP Redis DLL on a Windows machine?
- How can I use PHP and Redis to retrieve a range of values from a sorted set?
- How do I install PHP Redis on Ubuntu 20.04?
- How can I use PHP to increment values in Redis using ZINCRBY?
- How do I use the PHP Redis zrevrange command?
- How do I use yum to install php-redis?
- How can I use the zscan command in PHP with Redis?
See more codes...