已安装 php-curl 和 php7.3-curl,但 curl_init() 是“未定义函数”(Debian buster)

已安装 php-curl 和 php7.3-curl,但 curl_init() 是“未定义函数”(Debian buster)

自从升级到 buster 后,我的 web 服务器出现了问题。PHP 似乎看不到 curl 库:

root@myserver ~ # php -r "curl_init();"
PHP Fatal error:  Uncaught Error: Call to undefined function curl_init() in Command line code:1
Stack trace:
#0 {main}
  thrown in Command line code on line 1

root@myserver ~ # apt-get install php-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
php-curl is already the newest version (2:7.3+69).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
root@myserver ~ # apt-get install php7.3-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
php7.3-curl is already the newest version (7.3.14-1~deb10u1).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
root@myserver ~ #
root@myserver ~ # php --version
PHP 7.0.33-1~dotdeb+8.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.33-1~dotdeb+8.1, Copyright (c) 1999-2017, by Zend Technologies


肯定是件很愚蠢的事,但是什么呢?

答案1

您拥有php7.3-curlPHP 7.3,但您的 PHP CLI 是 PHP 7.0.33-1~dotdeb+8.17.0Zend OPcache

您是否已php7.3-cli安装?如果没有,那么

sudo apt install php7.3-cli

相关内容