ubuntu16.04环境LNMP实现PHP5.6和PHP7.2

最近因为公司突然间说要升级php7,所以做个记录

PPA 方式安装 php7.2 :

sudo apt-get install software-properties-common

 

添加 php7 的 PPA

sudo add-apt-repository ppa:ondrej/php 

 

更新安装包

sudo apt-get update 

运行这行命令的时候,报错了,错误信息如下

Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh > /dev/null; fi'

解决方法(三局命令)

sudo pkill -KILL appstreamcli

wget -P /tmp https://launchpad.net/ubuntu/+archive/primary/+files/appstream_0.9.4-1ubuntu1_amd64.deb https://launchpad.net/ubuntu/+archive/primary/+files/libappstream3_0.9.4-1ubuntu1_amd64.deb

sudo dpkg -i /tmp/appstream_0.9.4-1ubuntu1_amd64.deb /tmp/libappstream3_0.9.4-1ubuntu1_amd64.deb

 

 

检验是否安装成功,运行命令如若成功就能开始安装php7.2

apt-cache search php7.2

 

php7.2安装

sudo apt-get -y install php7.2

apt-get install php7.2-dev

 

安装PHP7.2的各个模块

sudo apt-get -y install php7.2-mysql

sudo apt-get install php7.2-fpm

apt-get install php7.2-curl php7.2-xml php7.2-json php7.2-gd php7.2-mbstring

 

执行 whereis php | grep php7.2 找到对应的命令(/usr/bin/php7.2),执行/usr/bin/php7.2 -v 查看信息

 

附注参考资料:https://www.linuxidc.com/Linux/2018-08/153463.htm

转载于:https://www.cnblogs.com/zhp-king/p/11047880.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值