Fix curl_init() Undefined Function with php-curl and php7.3-curl on Debian Buster

curldebian-busterPHP

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?

Best Answer

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
Related Topic