安装Apache 2.4
更新源:
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
安装服务:
yum -y install httpd
CentOS7启动服务:
systemctl start httpd.service
CentOS7设置开机启动服务:
systemctl enable httpd.service
安装源
安装 EPEL 软件包:
$ sudo yum install epel-release
安装 remi 源:
$ sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
安装 yum 扩展包:
$ sudo yum install yum-utils
启用 remi 仓库:
$ sudo yum-config-manager --enable remi-php72 $ sudo yum update
安装 PHP 服务
安装 PHP7,2
$ sudo yum install php72
输入 php72 -v
查看安装结果
安装 php-fpm 和一些其他模块:
$ sudo yum install php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache
安装扩展:
yum install mod_php72w
安装编译:
yum install php72w-devel
yum install centos-release-scl
sudo yum install devtoolset-7
scl enable devtoolset-7 bash
安装pecl:
yum install php-devel php-pear
php-fpm 服务
设置开机自启
$ sudo systemctl enable php72-php-fpm.service
常用 php-fpm 命令
# 开启服务
$ sudo systemctl start php72-php-fpm.service
# 停止服务
$ sudo systemctl stop php72-php-fpm.service
# 查看状态
$ sudo systemctl status php72-php-fpm.service
路径整理
# nginx 配置文件
/etc/nginx/nginx.conf
# nginx 默认项目路径
/usr/share/nginx/html