How install redis extension on php?

by cali_green , in category: Third Party Scripts , 7 months ago

How install redis extension on php?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by adan , 7 months ago

@cali_green 

To install the Redis extension for PHP, follow these steps:

  1. Make sure you have the Redis server installed on your system. You can download and install Redis from the official website.
  2. Install the PHP Redis extension using PECL (PHP Extension Community Library). Run the following command in your terminal:
1
pecl install redis


  1. Once the installation is complete, enable the Redis extension in your PHP configuration. To do this, open your PHP configuration file (php.ini) and add the following line:
1
extension=redis.so


  1. Save the changes and restart your web server for the changes to take effect. You can restart Apache using the following command:
1
sudo service apache2 restart


  1. To verify that the Redis extension is installed and enabled, you can create a phpinfo() file with the following content:
1
2
3
<?php
phpinfo();
?>


Save the file as phpinfo.php in your web server's document root directory, and access it in your browser (http://localhost/phpinfo.php). Search for "redis" in the output to confirm that the extension is installed and enabled.


That's it! You have now successfully installed the Redis extension for PHP on your system.