美文网首页
在Ubuntu下,安装php及相关扩展

在Ubuntu下,安装php及相关扩展

作者: gsunneverdie | 来源:发表于2019-10-09 22:42 被阅读0次
  • 在Ubuntu下,安装php
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.3

相关:Linux中apt与apt-get命令的区别与解释

Ubuntu 的软件源配置文件是 /etc/apt/sources.list,将系统自带的该文件做个备份,将该文件替换为国内源(清华,中科大)

  • 更新仓库索引
sudo apt-get update

可能会出现,错误:

Err:5 http://packages.blackfire.io/debian any InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 696DBE66A72D76DA
H

则需要添加公钥,见下面处理:

  • 添加公钥
// 命令
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9A2FD067A2E3EF7B
// 结果
gpg: keyserver receive failed: Server indicated a failure

还是错误,则更改为

// 命令
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9A2FD067A2E3EF7B
// 结果
Executing: /tmp/apt-key-gpghome.mTGQWBR2AG/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv 9A2FD067A2E3EF7B
gpg: key 9A2FD067A2E3EF7B: "Launchpad PPA for GNS3" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

增加:hkp:,端口:80

  • 仓库中提供的php模块
sudo apt-cache search php7*
  • 安装php模块
sudo apt-get install php7.2-mysql php7.2-curl php7.2-json php7.2-cgi php7.2-xsl
  • 自动删除不需要的包
sudo apt autoremove

相关文章

网友评论

      本文标题:在Ubuntu下,安装php及相关扩展

      本文链接:https://www.haomeiwen.com/subject/jvenpctx.html