predisHow can I install and configure Redis on an Ubuntu server running PHP?
-
Install Redis on Ubuntu server:
sudo apt-get install redis-server
This will install Redis server on the server.
-
Configure Redis: Edit the Redis configuration file
/etc/redis/redis.conf
and set thebind
directive to the IP address of the server. -
Start Redis:
sudo service redis-server start
This will start the Redis server.
-
Test Redis:
redis-cli ping
Output:
PONG
-
Install PHP Redis extension:
sudo apt-get install php-redis
This will install the Redis extension for PHP.
-
Configure PHP Redis extension: Edit the
php.ini
file and add the lineextension=redis.so
. -
Restart Apache:
sudo service apache2 restart
This will restart Apache and enable the Redis extension.
Helpful links
More of Predis
- 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 Redis with the Yii PHP framework?
- How can I use the PHP Redis HGET command?
- How can I use the zscan command in PHP with Redis?
- How can I use Predis with a cluster in PHP?
- How can I check the version of PHP and Redis I am using?
- How can I configure a PHP application to use Redis with a specific timeout?
- How can I use PHP to increment values in Redis using ZINCRBY?
- How can I use PHP and Redis to retrieve data from a sorted set using ZRANGEBYSCORE?
See more codes...