Yum installation and configuration method for PHP7: 1. Install nginx; 2. Configure the source of PHP7 through "yum install epel-release"; 3. Officially install php7-fpm through yum; 4. Install MySQL; 5. Configure nginx; 6. Start php-fpm.
The operating environment of this article: centos7 system, PHP7 version, DELL G3 computer
How to install and configure PHP7 with yum?
Centos 7 teaches you step by step how to install and configure Nginx php7-fpm MySQL using YUM method:
What you need to prepare
A pure system server
Tools for remote connection to the server (I Xshell is used here)
Students who need Xshell can visit my article to get it ->Click to visit
Install nginx
After connecting to the server, execute yum install nginx
You need to enter y
here and then return Car, start installing nginx
In the above picture, nginx has been installed!
Now install php7-fpm
First we Configure the source of PHP7
yum install epel-release
Enter y
here to confirm the installation and press Enter
The picture above indicates that the installation is complete!
Add the source of PHP7 below
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
The picture above indicates that the addition is complete!
The following is the formal installation php7-fpm
yum install php70w-fpm php70w-cli php70w-gd php70w-mcrypt php70w-mysql php70w-pear php70w-xml php70w-mbstring php70w-pdo php70w-json php70w-pecl-apcu php70w-pecl-apcu-devel
Copy the above code and execute
y
Continue
y
Continue
The PHP7-FPM installation is completed!
Now install MySQL
First add the source of MySQL7
rpm -Uvh http://repo.mysql.com/mysql57-community-release-el7-7.noarch.rpm
Copy the above code and execute
Add successfully!
Install MySQL
yum install mysql-server mysql-devel mysql
y
It will take some time to continue the MySQL installation and wait patiently
y
Continue
The picture above indicates that the MySQL installation is complete
The configuration will be updated after time!!
The following is the configuration after installation
Configure nginx first
Enter the configuration directory of nginx/etc/nginx
Edit nginx.conf
This file
change nginx.conf
Delete the contents of lines 38-57
in the file
删除完成后保存即可!
下面我们在conf.d
这个目录中创建站点的配置文件,例如first.conf
文件中的内容如下
server { listen 80; server_name (站点域名 没有就用IP代替); root /www/first(网站根目录); index index.php index.html; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
假设我们的站点配置在/www/first
这个目录中(这个目录没有 需要我们自己创建)
上图是创建目录
下面编辑站点文件
在站点目录下面创建index.php
内容如下
<?php phpinfo();
下面配置php-fpm 位置在/etc/php-fpm.d/www.conf
将原来的apache改成nginx
下面我们How to install and configure PHP7 with yum为nginx
下面启动nginx
启动: service nginx start
停止: service nginx stop
检查配置文件是否正确: nginx -t
启动php-fpm
启动: service php-fpm start
停止: service php-fpm stop
检查配置文件是否正确: php-fpm -t
两个服务都启动后就可以在浏览器中访问站点了!
下面配置MySQL
下面启动mysql
启动: service mysqld start
停止: service mysqld stop
需要先启动mysql
再查看一下mysql的默认密码
grep 'temporary password' /var/log/mysqld.log
密码是随机的
下面连接mysql
使用默认密码链接成功
现在还不能进行任何操作 必须先修改密码 当前版本的mysql对密码强度要求就高
ALTER USER 'root'@'localhost' IDENTIFIED BY 'GuYuePass666!';
下面How to install and configure PHP7 with yum
FLUSH PRIVILEGES;
然后我们退出mysql重新连接就是我们设置的密码了!
到这里我们大功告成!
推荐学习:《PHP视频教程》
The above is the detailed content of How to install and configure PHP7 with 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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Atom editor mac version download
The most popular open source editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Zend Studio 13.0.1
Powerful PHP integrated development environment

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
