简体   繁体   English

Apache php:对 curl_init() 的未定义调用

[英]Apache php: undefined call to curl_init()

I've problem implementing curl in my php-script.我在我的 php 脚本中实现 curl 时遇到问题。 Apache2 server-log gives the following: Apache2 服务器日志给出以下内容:

PHP Fatal error:  Uncaught Error: Call to undefined function curl_init()

I dont know how to solve it.我不知道如何解决它。 I've made the following:我做了以下内容:

php.ini php.ini

uncommented the line取消注释该行

extension=curl

even tried with full path甚至尝试使用完整路径

extension=/usr/bin/curl

.. ..

extension=/bin/curl

and even file extension ie甚至文件扩展名

extension=curl.so

Even checked the system if I have php-curl如果我有 php-curl 甚至检查系统

dpkg -l|grep -i curl

output: output:

ii  curl                                  7.64.0-4+deb10u1                            amd64         command line tool for transferring data with URL syntax
ii  libcurl3-gnutls:amd64                 7.64.0-4+deb10u1                            amd64        easy-to-use client-side URL transfer library (GnuTLS flavour)
ii  libcurl4:amd64                        7.64.0-4+deb10u1                            amd64        easy-to-use client-side URL transfer library (OpenSSL flavour)
ii  php-curl                              2:7.3+69                                    all          CURL module for PHP [default]
ii  php7.3-curl                           7.3.19-1~deb10u1                            amd64        CURL module for PHP

How could it be solved?怎么解决的?

Also checked php configuration through还通过检查 php 配置

phpinfo();

according to:根据:

Apache/PHP undefined function curl_init() Apache/PHP 未定义 function curl_init()

But no such section about curl is residing in it但是其中没有关于 curl 的部分

YES - I know this question has been asked several times, mostly for windows, and by now I cannot find any solution.是 - 我知道这个问题已经被问过好几次了,主要是针对 windows,现在我找不到任何解决方案。 If you consider this a duplicate, please help me with a link to a really good answer.如果您认为这是重复的,请帮助我提供一个非常好的答案的链接。 I've checked and keep checking but by the moment I cannot find any appropriate solution I've tried the answer of some of the links我已经检查并继续检查,但到目前为止我找不到任何合适的解决方案我已经尝试了一些链接的答案

It seems like the PHP instance you are running does not read the php.ini file you have updated to include curl.您正在运行的 PHP 实例似乎没有读取您已更新为包含 curl 的 php.ini 文件。

Did you try running php_ini_loaded_file() to figure out which file exactly is loaded from disk to use as PHP configuration?您是否尝试运行 php_ini_loaded_file() 来确定从磁盘加载哪个文件以用作 PHP 配置? ( https://www.php.net/php_ini_loaded_file ) ( https://www.php.net/php_ini_loaded_file )

In some environments (if not most) PHP can run from different configurations (eg webserver or commandline) and they can all have their own php.ini configuration.在某些环境中(如果不是大多数)PHP 可以从不同的配置(例如网络服务器或命令行)运行,并且它们都可以有自己的 php.ini 配置。 If you find the correct ini file, restart the webserver again before verifying the new configuration via phpinfo().如果找到正确的 ini 文件,请在通过 phpinfo() 验证新配置之前再次重新启动网络服务器。

You can also run php --ini from the commandline to see which ini files are used there.您还可以从命令行运行 php --ini 以查看那里使用了哪些 ini 文件。

Update, more info on my suggestion can be found here: php.ini: which one?更新,关于我的建议的更多信息可以在这里找到: php.ini:哪个?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM