Home > Database > Redis > body text

How to install redis and php extensions under lunix

WBOY
Release: 2023-05-27 14:40:06
forward
653 people have browsed it

  1. Installing Redis

First, you need to install Redis in the Linux system. The installation can be completed through the following command:

sudo apt-get install redis-server
Copy after login

After the installation is completed, you can use the following command to check whether the Redis service has been started:

sudo service redis-server status
Copy after login

If the service has been started, results similar to the following will be output. :

redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-10-27 11:17:38 CST; 2 days ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
  Process: 4187 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS)
  Process: 4188 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
 Main PID: 4223 (redis-server)
    Tasks: 4 (limit: 4915)
   CGroup: /system.slice/redis-server.service
           └─4223 /usr/bin/redis-server 127.0.0.1:6379
Copy after login
  1. Install PHP extension

##After installing Redis, you need to install the Redis extension integrated with PHP.

First you need to confirm that PHP has been installed. You can use the following command to check:

php -v
Copy after login

If PHP is already installed, you can use the following command to install the Redis extension:

sudo apt-get install php-redis
Copy after login

After the installation is complete, you need to add the Redis extension to the PHP configuration file. You can use the following command to open the PHP configuration file:

sudo vi /etc/php/7.0/apache2/php.ini
Copy after login

Find the following content in the opened configuration file:

;extension=redis.so
Copy after login

Remove the semicolon to enable the Redis extension:

extension=redis.so
Copy after login

Save the file and exit. Next, you need to restart the Apache server for the update to take effect:

sudo service apache2 restart
Copy after login
After completing the above steps, the Redis extension has been integrated into PHP, and you can happily use Redis for development!

The above is the detailed content of How to install redis and php extensions under lunix. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!