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 do I install and configure a PHP Redis DLL on a Windows machine?
- How can I set a timeout for a Redis connection using PHP?
- How can I list keys in Redis using PHP?
- How can I optimize the memory usage of Redis when using PHP?
- How do I use the PHP Redis zrevrange command?
- How do I install PHP, Redis, and XAMPP?
- How do I use PHP Predis with TLS encryption?
- How can I use Redis with the Yii PHP framework?
- How do I use yum to install php-redis?
- How can I install and configure PHP and Redis on a Windows system?
See more codes...