大网数据广告活动
服务器运维问答

php-curl and php7.3-curl installed but curl_init() is "undefined function" (Debian buster)

· 52CE 我爱测

I have a problem with my web server since upgrading to buster. PHP doesn't seem to see the curl library : root@myserver ~ # php -r "curl_init();" PHP Fatal error: Uncaught Error: Call to undefined function curl_init() in Command …

问题原文

原帖链接 · danmcb · CC BY-SA 4.0

I have a problem with my web server since upgrading to buster. PHP doesn't seem to see the curl library :

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


Must be something very silly, but what?

已采纳解答

原帖链接 · Esa Jokinen · CC BY-SA 4.0

You have php7.3-curl for PHP 7.3, but your PHP CLI is PHP 7.0 7.0.33-1~dotdeb+8.1 from Zend OPcache.

Do you have php7.3-cli installed? If not, then

sudo apt install php7.3-cli

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-05-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。