Php
已安裝 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
一定是非常愚蠢的事情,但是什麼?
你有
php7.3-curl
PHP 7.3,但你的 PHP CLI 是7.0.33-1~dotdeb+8.1
來自Zend OPcache的 PHP 7.0 。你
php7.3-cli
安裝了嗎?如果沒有,那麼sudo apt install php7.3-cli