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!

因为需要用到C++11,但CentOS自带的gcc4.4.7不支持,所以决定升级gcc。操作如下:#备份mv/etc/yum.repos.d/devtools-2.repo/etc/yum.repos.d/devtools-2.repo.bakwgethttp://people.centos.org/tru/devtools-2/devtools-2.repo-O/etc/yum.repos.d/devtools-2.repoyuminstalldevtoolset-2-gccdevtoolse

1.下载gitlab安装包从【清华大学开源软件镜像站】下载最新中文版gitlab安装包,安装包里自带了简体中文汉化包。从【gitlab官网】下载gitlab最新安装包。2.安装gitlab以gitlab-ce-14.9.4-ce.0.el7.x86_64为例,将其上传至centos服务器使用yum安装gitlabyum-yinstallgitlab-ce-14.3.2-ce.0.el7.x86_64.rpm使用yum安装gityum-yinstallgit#安装git修改gitlab配置文件vi

在linux中,yum是一个专门为了解决包的依赖关系而存在的软件包管理器;yum是改进型的RPM软件管理器,它很好的解决了RPM所面临的软件包依赖问题。当管理员使用yum安装RPM包时,yum会先从服务器端下载包的依赖性文件,通过分析此文件从服务器端一次性下载所有相关的RPM包并进行安装。

一般来说著名的Linux系统基本上分两大类:RedHat系列:Redhat、Centos、Fedora等;Debian系列:Debian、Ubuntu等。yum(YellowdogUpdater,Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器。apt(AdvancedPackagingTool)是一个在Debian和Ubuntu中的Shell前端软件包管理器。概述一般来说著名的Linux系统基本上分两大类:RedHat系列:Redhat、Cento

centos7 yum删除php的方法:1、通过“php-v”查看PHP版本;2、使用“rpm -qa|grep php”查看已经安装的PHP相关扩展;3、通过执行“yum remove php”命令卸载php即可。

linux使用yum安装php的方法:1、执行“mkdir /usr/local/php”命令;2、下载yum源的更新安装包;3、安装相关yum源安装包;4、通过“yum install”命令安装php即可。

在CentOS7上安装和部署Docker非常简单,只需要几个简单的步骤即可完成。下面是详细的步骤和说明:更新系统在安装Docker之前,首先需要更新CentOS7操作系统。使用以下命令可以更新系统:sudoyumupdate安装必要的软件包在CentOS7上安装Docker需要安装一些必要的软件包,包括yum-utils、device-mapper-persistent-data和lvm2。使用以下命令安装这些软件包:sudoyuminstall-yyum-utilsdevice-mapper-

大家都或许熟悉Linux系统中的yum,但初学者可能对它并不了解。本文将介绍yum是什么,以及它的功能。请继续阅读。 在Linux中,yum是一个包管理器,用于管理和安装软件包。它是YellowdogUpdater,Modified的缩写,最初是为RedHat系列发行版设计的,但现在也被其他许多基于RPM的Linux发行版所采用。 YUM命令的主要功能包括:YUM是一种软件包管理工具,可用于查找、安装、更新和卸载软件包。通过YUM命令,用户可以方便地管理系统上的软件包,并自动解决软件包之间的


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

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Chinese version
Chinese version, very easy to use

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

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