centos 6 安装 php 7.1

更新日期: 2019-03-19 阅读次数: 8687 字数: 182 分类: PHP

查看 centos 系统版本号

cat /etc/redhat-release
CentOS release 6.9 (Final)

安装 php 7.1

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
yum install mod_php71w php71w-opcache
yum install php71w-cli php71w-mysql php71w-bcmath php71w-gd php71w-mcrypt php71w-mbstring php71w-odbc php71w-xml

安装完成之后确认 php 版本号

php -v
PHP 7.1.26 (cli) (built: Jan 12 2019 10:21:49) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.26, Copyright (c) 1999-2018, by Zend Technologies

安装 fpm

安装完之后,发现没有 php-fpm 服务

service php-fpm start
php-fpm: unrecognized service

使用 chkconfig 查看确实没有 fpm 服务

chkconfig --list

安装 fpm

yum install php71w-fpm

确认服务已安装

chkconfig --list
> php-fpm         0:off   1:off   2:off   3:off   4:off   5:off   6:off

启动 fpm 服务

service php-fpm start
Starting php-fpm:                                          [  OK  ]

参考

  • http://www.xiaoshu168.com/linux/32.html
  • https://www.svennd.be/installing-nginx-php-7-on-centos-6-7/
  • https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-6

关于作者 🌱

我是来自山东烟台的一名开发者,有敢兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊, 查看更多联系方式