运行环境

系统版本:CentOS Linux release 7.3.1611

软件版本:PHP-7.2

硬件要求:无

安装过程

1、配置YUM-REMI存储库

YUM-REMI存储库由REMI官方提供。

[root@localhost ~]# rpm -i http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
[root@localhost ~]# rpm -i https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

2、安装PHP72+Nginx

[root@localhost ~]# yum -y install php72 php72-php-bcmath php72-php-fpm php72-php-gd php72-php-mbstring php72-php-mysqlnd php72-php-opcache php72-php-pecl-crypto php72-php-pecl-mcrypt php72-php-pecl-memcache php72-php-pecl-mysql php72-php-pecl-redis php72-php-pecl-swoole nginx

3、启动PHP-FPM服务

[root@localhost ~]# systemctl start php72-php-fpm.service
[root@localhost ~]# systemctl enable php72-php-fpm.service

4、配置Nginx反代PHP

[root@localhost ~]# vim /etc/nginx/conf.d/php72
server {
listen 8080;
server_name _php;
root "/usr/share/nginx/html"; location / {
index index.php index.html;
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
} location ~ ^.*\.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
#连接到PHP-FPM,这里采用UNIX套接字的连接方式,设置由PHP-FPM提供的UNIX套接字文件路径。
fastcgi_index index.php;
#设置PHP默认首页文件。
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
#设置FastCGI的一个环境变量"SCRIPT_FILENAME",设置FastCGI服务器读取的PHP入口文件完整路径。
include fastcgi_params;
#包含当前配置目录下"fastcgi_param"文件中的所有配置,该文件中存储了一些默认配置FastCGI服务器的一些环境变量,这些变量都有特殊的作用,一般情况下无需修改。
}
}

5、创建一个PHP测试页面

[root@localhost ~]# vi /usr/share/nginx/html/index.php
<?php
phpinfo()
?>

6、启动Nginx

[root@localhost ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@localhost ~]# systemctl start nginx
[root@localhost ~]# systemctl enable nginx

7、访问到PHP页面

直接在浏览器输入地址+端口即可。

安装PHP到CentOS(YUM)的更多相关文章

  1. Ejabberd2:安装和操作指南(centos yum 安装ejabberd)

    (1)首先安装EPEL Repository     ## RHEL/CentOS 6 32-Bit ##  # wget http://download.fedoraproject.org/pub/ ...

  2. centos yum 安装 mongodb 以及php扩展

    centos yum 安装 mongodb 以及php扩展 投稿:hebedich 字体:[增加 减小] 类型:转载 MongoDB是一个基于分布式文件存储的数据库.由C++语言编写.旨在为WEB应用 ...

  3. yum-config-manager YUM安装遭遇: [Errno 256] No more mirrors to try CentOS yum之$releasever和$basearch

    YUM安装遭遇: [Errno 256] No more mirrors to try createrepo 有问题. CentOS yum之$releasever和$basearch分类: 操作系统 ...

  4. redhat centos yum源的安装

    redhat centos yum源的安装 1.除旧 #cd /etc/yum.repos.d #mv rhel-debuginfo.repo rhel-debuginfo.repo.bak 此处将其 ...

  5. 【转】CentOS yum安装和卸载软件的使用方法

    在CentOS yum安装和卸载软件的使用方法安装方法安装一个软件时.   CentOS yum -y install httpd安装多个相类似的软件时   CentOS yum -y install ...

  6. CentOS6.5系统挂载NTFS分区的移动硬盘 centos安装repoforge源(yum)

    CentOS6.5系统挂载NTFS分区的移动硬盘 作为IT的工作者,避免不了使用Linux系统,我现在使用的系统是CentOS6.5 X86_64位版本,但是插入NTFS移动硬盘没有办法识别.通过下面 ...

  7. centos的软件安装方法rpm和yum

    centos的软件安装大致可以分为两种类型: [centos]rpm文件安装,使用rpm指令  类似[ubuntu]deb文件安装,使用dpkg指令 [centos]yum安装   类似[ubuntu ...

  8. RHEL 6.3使用CentOS yum源 (redhat yum安装失败)

    由于Redhat的yum在线更新是收费的,如果没有注册的话是不能使用的,即不能在线安装软件.所以yum install 命令每次都安装失败 下面介绍一种更改yum源的方式: 系统说明: 系统:Red ...

  9. CentOS yum 安装 PHP 5.6.24

    配置yum源 追加CentOS 6.5的epel及remi源. # rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel- ...

  10. linux CentOS YUM 安装 nginx+tomcat+java+mysql运行环境

    Java环境配置 1 安装JDK 查看CentOS自带JDK是否已安装 1 [root@test ~]# yum list installed |grep java 若有自带安装的JDK,应如下操作进 ...

随机推荐

  1. HanLP《自然语言处理入门》笔记--2.词典分词

    2. 词典分词 中文分词:指的是将一段文本拆分为一系列单词的过程,这些单词顺序拼接后等于原文本. 中文分词算法大致分为基于词典规则与基于机器学习这两大派. 2.1 什么是词 在基于词典的中文分词中,词 ...

  2. openstack 架构

    openstack 概念架构: openstack逻辑架构 常见的架构:

  3. Android Webview实现有道电子词典

    毕业设计android电子词典,先实现的一个小小的demo. 所谓的毕业设计就是用最短的时间学习一门语言,做出一个小的project. activity_main.xml <LinearLayo ...

  4. selenium 环境配置

    一.确认系统中已安装python版本,如果没有,请参考[这里] 二.打开系统命令页面 [window + R].输入cmd回车 三.cmd环境下,用[pip install selenium ]命令安 ...

  5. AI产品经理工作流程——需求分析和产品设计

    1.AI产品设计常见失败原因 技术驱动产品设计,即我有什么技术就做什么产品.尽管许多公司不惜重金招聘高级AI算法工程师,确实这样也能帮助企业拿到大量的融资,但也容易给公司带来技术决定产品设计的局限.然 ...

  6. Linux 查看磁盘容量、查找大文件、查找大目录

    Linux 查看磁盘容量.查找大文件.查找大目录 磁盘统计 查看磁盘使用情况 df -h 文件统计 查找/home 目录下大于800M的文件 find /home -type f -size +800 ...

  7. LeetCode 684. Redundant Connection 冗余连接(C++/Java)

    题目: In this problem, a tree is an undirected graph that is connected and has no cycles. The given in ...

  8. 使用github--stanfordnlp--glove训练自己的数据词向量

    1.准备语料 准备好自己的语料,保存为txt,每行一个句子或一段话,注意要分好词.将分好词的语料保存为×××.txt 2.准备源码 下载地址:https://github.com/stanfordnl ...

  9. nethogs-linux程序网络使用情况

    netthogs可以显示每个程序的网络传输情况安装nethogs工具yum install https://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/Pac ...

  10. FastDFS 配置文件 client.conf storage_ids.conf

    client.conf : # connect timeout in seconds # default value is 30s connect_timeout=30              连接 ...