CentOS7 下 安装php7.2

作者: 麻辣阁 分类: wordpress 发布时间: 2018-11-20 15:05

安装

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 install php72w php72w-fpm php72w-cli php72w-common php72w-devel php72w-gd php72w-pdo php72w-mysqlnd php72w-mbstring php72w-bcmath php72w-xml php72w-opcache
  • 可以使用 yum search php72w 查询可以安装的模块
  • 安装 php72w-mysql 可能导致 Headers and client library minor version mismatch , 建议安装 php72w-mysqlnd

部分模块解释:

  • php72w-xml:解析上传的备份文件等用
  • php72w-opcache:使用 opcache

适配 nginx

vi /etc/php-fpm.d/www.conf, 该配置非常重要,如果不修改会导致 wordpress需要写入权限的升级出问题. 如果web 服务器是 Apache,应该不用修改.

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
; RPM: apache Choosed to be able to access some dir as httpd
;user = apache
user = nginx
; RPM: Keep a group allowed to write in log dir.
;group = apache
group = nginx

设置开机启动,启动服务,查看php版本:

systemctl enable php-fpm.service
service php-fpm start
php -v

发表评论

电子邮件地址不会被公开。 必填项已用*标注