AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1282005
Accepted
Ananda
Ananda
Asked: 2020-10-12 14:03:04 +0800 CST2020-10-12 14:03:04 +0800 CST 2020-10-12 14:03:04 +0800 CST

php-curl 未安装在 php 7.4 中

  • 772

我正在尝试在终端中安装 php-curl 但此命令显示

    linux@Lenovo:~$ sudo apt-get install php-curl 

    Reading package lists... Done Building dependency tree       
Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:
        
        The following packages have unmet dependencies:  
    php-curl : Depends: php7.4-curl but it is not going to be installed 
    E: Unable to correct problems, you have held broken packages.
php php7
  • 3 3 个回答
  • 16208 Views

3 个回答

  • Voted
  1. Herman Grobler
    2021-01-02T19:44:28+08:002021-01-02T19:44:28+08:00

    您可以通过 ondrej/php PPA 添加它:

    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    sudo apt-get install php7.4-curl
    
    • 3
  2. James Cobban
    2021-01-15T18:14:05+08:002021-01-15T18:14:05+08:00

    在 AskUbuntu 上发布了许多关于 PHP 的旧功能(例如 CURL)以及用于 SQL 数据库访问的面向过程的功能的问题,这些功能在 Ubuntu 20.04 和 PHP 7.4 开箱即用时不起作用。

    似乎更现代特性的传播者选择弃用旧特性实现,即使 PHP 文档中没有任何内容暗示这些特性已被弃用。这些旧接口被许多现有应用程序使用,因此应该位于受支持的存储库中,或者必须为受支持的替代方案提供明确的指针,这些替代方案需要将代码重写为现代标准。特别是在curl_init的 PHP 文档中没有任何内容表明它不是PHP 的标准功能,以及通过 Internet 交换信息的推荐方式。甚至没有对stream_context_create的引用可以与 fopen、readfile 或 SplFileObject 一起使用。例如,代替 curl_... 您可以使用以下内容,改编自对 stream_context_create 的文档页面的贡献:

    $opts = array(
            'http' => array (
                'method'=>"POST",
                'header'=>
                  "Accept-language: en\r\n".
                  "Content-type: application/x-www-form-urlencoded\r\n",
                'content'=>http_build_query(array('foo'=>'bar'))
      )
    );
    
    $context = stream_context_create($opts);
    
    $fp = fopen('https://www.example.com', 'r', false, $context);
    
    

    在我看来,以及为 Ubuntu 20.04 打包做出贡献的人的意见,使用更新的界面要清楚得多。为此,我刚刚在 curl_init 的 PHP 文档中添加了一个用户贡献的注释。

    • 1
  3. Best Answer
    Himanshu S Shankhala
    2021-02-10T01:04:08+08:002021-02-10T01:04:08+08:00
    sudo apt update
    sudo apt install php7.4-curl
    sudo service apache2 restart
    
    • 0

相关问题

  • VirtualHost 的自定义 php.ini

  • http://localhost/ 不工作

  • 如何安装 php-gtk?

  • 我如何创建自己的 php 5.3.3 包/ppa?

  • 如何回滚到 PHP 5.2?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve