无法找到包php5-curl

问题描述 投票:2回答:4

我有一台安装了Ubuntu 16.04的Linux服务器。我只是为了LAMPP环境,我安装了PHP 5.6(在apache和CLI中),因为项目因PHP7而崩溃,所以,我必须维护5.6版本。我正在尝试从CLI运行PHP脚本,我得到:未知函数中的curl_init()。所以,我去了php.ini文件(CLI之一)并且无法扩展,但在我做的时候在CLI中:php --version我得到:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/php_curl.dll' - /usr/lib/php/20131226/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0

然后我尝试用:sudo apt-get install php5-curl安装curl,但后来我得到:

E: Unable to locate package php5-curl

那么,那我该怎么办?我该如何安装呢?谢谢

php linux curl lamp
4个回答
5
投票

我遇到了添加此存储库所需的相同问题

sudo add-apt-repository ppa:ondrej/php
sudo apt update

3
投票

尝试运行我有这个命令解决了同样的问题

 sudo apt-get install php-curl

1
投票

在Ubuntu 16.04中,默认的PHP版本是7.0,如果你想使用不同的版本,那么你需要根据PHP版本安装PHP包:

1-> PHP 7.0: sudo apt-get install php7.0-curl
2-> PHP 7.1: sudo apt-get install php7.1-curl
3-> PHP 7.2: sudo apt-get install php7.2-curl
4-> PHP 5.5: sudo apt-get install php5.5-curl
5-> PHP 5.6: sudo apt-get install php5.6-curl

0
投票
  1. 添加此存储库 sudo add-apt-repository ppa:ondrej/php sudo apt update
  2. 选择你的PHP版本5.5,5.6,7.0,7.2 PHP 5.6:sudo apt-get install php5.6-curl
  3. 启用或禁用测试卷曲 创建index.php并添加此代码 echo 'Curl: ', function_exists('curl_init') ? 'Enabled' : 'Disabled';
© www.soinside.com 2019 - 2024. All rights reserved.