Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install redis using yum in php7

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to use yum to install redis in php7, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Php7 yum install redis method: 1, install Yum source and nginx;2, start nginx and set boot automatic operation; 3, view php7 yum components, and install php7.2;4, start php and set to boot; 5, use the specified yum source to install Redis.

This article operating environment: centos7 system, PHP7.2 version, Dell G3 computer.

Centos7 nginx+php7yum installation, and yum installation method of redis:

one。 Install nginx

1. Install the yum source

Rpm-Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

two。 Install nginx

Yum install-y nginx

3. Start nginx and set the boot to run automatically

Systemctl start nginx # start, restart- restart, stop- stop systemctl enable nginx # boot

4. View version and running status

Nginx-v # View version ps-ef | grep nginx # View running status

two。 Install php7

1. Install the 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

two。 Check out the php7 yum components, sample installation of php7.2

Yum search php72w

3. Choose the components you need to install, php72w.x86_64 and php72w-fpm.x86_64 as the core program must be installed

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 it to boot

Systemctl start php-fpm # start, restart- restart, stop- stop systemctl enable php-fpm # boot

5. View version and running status

Php-fpm-v # View version ps-ef | grep php-fpm # View running status

After completing the above steps, the reader can configure the web directory in nginx and 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.

three。 Modify nginx configuration

Vi / etc/nginx/conf.d/default.conf

Find this line in the first location

Index index.html index.htm

Modified to:

Index index.php index.html index.htm; # add index.php

two。 Remove the comments from the location below the FastCGI server line and change them to look like this

# pass the PHP scripts to FastCGI server listening on 127.0.0.1 fastcgi_pass 9000 # location ~ .php ${root directory of the root / usr/share/nginx/html; # website fastcgi_pass 127.0.0.1 usr/share/nginx/html; 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name Include fastcgi_params;} service nginx restart # restart nginxservice php-fpm start # enable 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:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report