How to install redis in php7 yum
How to install redis with php7 yum: 1. Install yum source and nginx; 2. Start nginx and set it to run automatically at boot; 3. Check the php7 yum component and install php7.2; 4. Start php and set it up To start at boot; 5. Use the specified yum source to install Redis.
The operating environment of this article: centos7 system, PHP7.2 version, Dell G3 computer.
centos7 nginx php7yum installation, and how to install redis with yum:
1. Install nginx
1. Install yum Source
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2. Install nginx
yum install -y nginx
3. Start nginx and set it to run automatically at boot
systemctl start nginx #启动,restart-重启,stop-停止 systemctl enable nginx #开机启动
4. Check the version and running status
nginx -v #查看版本 ps -ef | grep nginx #查看运行状态
2. Install php7
1. Install yum source
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
2. View the php7 yum component and install php7 as an example. 2
yum search php72w
3. Select the components you need to install. php72w.x86_64 and php72w-fpm.x86_64 are required for core programs.
yum install php72w.x86_64 php72w-fpm.x86_64 php72w-cli.x86_64 php72w-common.x86_64 php72w-gd.x86_64 php72w-ldap.x86_64 php72w-mbstring.x86_64 php72w-mcrypt.x86_64 php72w-mysql.x86_64 php72w-pdo.x86_64 php72w-pecl-redis.x86_64
4. Start php and set up Start for boot
systemctl start php-fpm #启动,restart-重启,stop-停止 systemctl enable php-fpm #开机启动
5. Check the version and running status
php-fpm -v #查看版本 ps -ef | grep php-fpm #查看运行状态
After completing the above steps, the reader can configure the web directory in nginx by himself, and it can run normally , but at this time nginx and php are running as root. Running web files with the highest permissions will bring security risks to the system. The following is an example of permission configuration
3. Modify nginx configuration
vi /etc/nginx/conf.d/default.conf
Find this line in the first location
index index.html index.htm;
and modify it to:
index index.php index.html index.htm; #添加index.php
2. Remove the comment of location under the FastCGI server line and modify it to the following Like this
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ .php$ { root /usr/share/nginx/html; #网站根目录 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } service nginx restart #重启nginx service php-fpm start #开启php-fpm
3. Create a new index.php file in the root directory of the website
vim /usr/share/nginx/html/index.php
Enter the content:
<?php phpinfo();
5. Enter in the browser Virtual machine IP, you can already see the phpinfo information. Modify the hosts file on Windows and add a line 192.168.6.114 www.test1.com \#Configure the domain name corresponding to the virtual machine IP
6. Now you can Use www.test1.com to access the server configured by the virtual machine
4.yum installation redis
When installing redis with yum, it is recommended to use Remi repository source. Because the Remi source provides the latest version of Redis, you can use YUM to install the latest version of Redis through this source. In addition, the latest yum sources of PHP and MySQL are provided, as well as related service programs.
1) Remi repository source depends on epel source, so you need to install epel source first
[root@youxi1 ~]# yum -y install epel-release
2) Install Remi repository source
[root@youxi1 ~]# yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm [root@youxi1 ~]# ls /etc/yum.repos.d/ //下载完成后会出现许多remi的yum源,这里要用到的是remi.repo这个源 CentOS-Base.repo CentOS-Sources.repo remi-glpi92.repo remi-php70.repo remi-safe.repo CentOS-CR.repo CentOS-Vault.repo remi-glpi93.repo remi-php71.repo CentOS-Debuginfo.repo epel.repo remi-glpi94.repo remi-php72.repo CentOS-fasttrack.repo epel-testing.repo remi-modular.repo remi-php73.repo CentOS-Media.repo remi-glpi91.repo remi-php54.repo remi.repo
3) Use the specified yum source to install Redis
[root@youxi1 ~]# yum --enablerepo=remi install -y redis //--enablerepo指定yum源 [root@youxi1 ~]# redis-cli --version //安装完成后使用命令查看一下版本 redis-cli 5.0.5
Note: After the remi source installation is completed, the default is not to start. When you need to use the remi repository source installation program, you need the --enablerepo=remi option to specify that the remi repository source can be used, and then to install.
4) Start Redis and set it to start automatically at boot
[root@youxi1 ~]# systemctl start redis [root@youxi1 ~]# systemctl enable redis Created symlink from /etc/systemd/system/multi-user.target.wants/redis.service to /usr/lib/systemd/system/redis.service.
Note: The port number of Redis is 6379
[Recommended learning: PHP video tutorial]
The above is the detailed content of How to install redis in php7 yum. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to install the mongo extension in php7.0: 1. Create the mongodb user group and user; 2. Download the mongodb source code package and place the source code package in the "/usr/local/src/" directory; 3. Enter "src/" directory; 4. Unzip the source code package; 5. Create the mongodb file directory; 6. Copy the files to the "mongodb/" directory; 7. Create the mongodb configuration file and modify the configuration.

In php5, we can use the fsockopen() function to detect the TCP port. This function can be used to open a network connection and perform some network communication. But in php7, the fsockopen() function may encounter some problems, such as being unable to open the port, unable to connect to the server, etc. In order to solve this problem, we can use the socket_create() function and socket_connect() function to detect the TCP port.

To resolve the plugin not showing installed issue in PHP 7.0: Check the plugin configuration and enable the plugin. Restart PHP to apply configuration changes. Check the plugin file permissions to make sure they are correct. Install missing dependencies to ensure the plugin functions properly. If all other steps fail, rebuild PHP. Other possible causes include incompatible plugin versions, loading the wrong version, or PHP configuration issues.

Common solutions for PHP server environments include ensuring that the correct PHP version is installed and that relevant files have been copied to the module directory. Disable SELinux temporarily or permanently. Check and configure PHP.ini to ensure that necessary extensions have been added and set up correctly. Start or restart the PHP-FPM service. Check the DNS settings for resolution issues.

How to install and deploy php7.0: 1. Go to the PHP official website to download the installation version corresponding to the local system; 2. Extract the downloaded zip file to the specified directory; 3. Open the command line window and go to the "E:\php7" directory Just run the "php -v" command.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Causes and solutions for errors when using PECL to install extensions in Docker environment When using Docker environment, we often encounter some headaches...

Compared with PHP7, PHP8 has some advantages and improvements in terms of performance, new features and syntax improvements, type system, error handling and extensions. However, choosing which version to use depends on your specific needs and project circumstances. Detailed introduction: 1. Performance improvement, PHP8 introduces the Just-in-Time (JIT) compiler, which can improve the execution speed of the code; 2. New features and syntax improvements, PHP8 supports the declaration of named parameters and optional parameters, making functions Calling is more flexible; anonymous classes, type declarations of properties, etc. are introduced.
