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

yContinue
yContinue
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


yIt will take some time to continue the MySQL installation and wait patiently

yContinue
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/nginxEdit nginx.confThis file
change nginx.confDelete 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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version
Chinese version, very easy to use

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






