在 Ubuntu 17.04 上安装 curl 和 MBstring PHP 7.1



我在 Ubuntu 17.04 上使用 php7.1,我尝试使用以下命令安装 cURL:

sudo apt-get install php-curl

但我得到这个:

软件包 'php-curl' 没有安装候选

我还尝试使用以下方法指定 cURL 版本:

sudo apt-get install php7.1-curl

但我得到了

E:找不到正则表达式'php7.1-curl的任何软件包

那么,请问我如何为 PHP 7.1 安装 curl?

您需要先添加 PHP ppa,更新并安装

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php7.1-curl

虽然你找不到php-curl似乎很奇怪,但你应该搜索系统上可用的php curl包版本:

sudo apt update
sudo apt search ^php

在结果之间,它应该显示如下内容(输出取自 Ubuntu 17.10,你的会有所不同(:

php7.1-curl/artful-updates,artful-security 7.1.15-0ubuntu0.17.10.1 amd64      适用于 PHP 的 CURL 模块

然后,您只需像往常一样安装它:

sudo apt install php7.1-curl

祝您编码愉快!

最新更新