php 调用未定义的函数 curl_init() 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29838649/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Call to undefined function curl_init() error
提问by saurav
I am on a Win 64 bit OS, php 5.6.8 using Eclipse PDT to develop PHP.
我在 Win 64 位操作系统上,php 5.6.8 使用 Eclipse PDT 来开发 PHP。
I have come across this Call to undefined function curl_init() error.
我遇到了这个 Call to undefined function curl_init() 错误。
I removed the ;
preceeding extension=php_curl.dll
in php.ini.Restarted the Apache server but still getting the same error.
我删除了php.ini 中的;
前面部分extension=php_curl.dll
。重新启动了 Apache 服务器,但仍然出现相同的错误。
Any hint where I am going wrong?
任何提示我哪里出错了?
回答by nico
I had the same issue and after hours, I found a message here :
我遇到了同样的问题,几个小时后,我在这里找到了一条消息:
http://php.net/manual/curl.installation.php
http://php.net/manual/curl.installation.php
which says, "Upgrading to php 5.6.9 on Windows 7 x64 cURL no longer is recognized. No errors on server start package just not available and didn't show in phpinfo.php
. deplister.exe
was ok
I fixed coping the following list files from php folder (in my case D:\xampp\php) libeay32.dll
, libssh2.dll
, ssleay32.dll
to c:\xampp\apache\bin
(or your apache\bin
path), restart Apache and works fine, Apache's libraries were outdated."
上面写着,“在 Windows 7 x64 cURL 上升级到 php 5.6.9 不再被识别。服务器启动包上没有错误,只是不可用并且没有显示在phpinfo.php
.中。deplister.exe
没关系我修复了从 php 文件夹(在我的情况 D:\xampp\php) libeay32.dll
, libssh2.dll
, ssleay32.dll
to c:\xampp\apache\bin
(或您的apache\bin
路径),重新启动 Apache 并正常工作,Apache 的库已过时。”
It worked for me.
它对我有用。
Not easy to find, right ? :-)
不容易找到吧?:-)
回答by leopold
Your issue is probably already solved. But for those still searching, please find my answer here.
你的问题可能已经解决了。但对于那些仍在寻找的人,请在这里找到我的答案。
It might be the the wrong Path being pointed at.
可能是指向了错误的 Path。
My answer in the Link ( Call to undefined function curl_init() even it is enabled in php7) says:
我在链接中的回答(调用未定义的函数 curl_init() 即使它在 php7 中启用)说:
Your Filepath is probably incorrect
您的文件路径可能不正确
Check the Apache error log in
检查Apache错误日志
/var/log/apache2/error.log
if the called path or filename does match your real path in e.g.
如果被调用的路径或文件名与您的真实路径匹配,例如
/usr/lib/php/20151012/php_curl.so
In my case it's been the same path, but "the php_" was missing
在我的情况下,它是相同的路径,但缺少“php_”
/usr/lib/php/20151012/curl.so
So I changed the path / filename accordingly in
所以我相应地更改了路径/文件名
/etc/php/7.0/cli/conf.d/20-curl.ini
from
从
extension=php_curl.so
into
进入
extension=curl.so
回答by Vipin Jain
Just add php folder path in PATH environment variable..... ;)
只需在 PATH 环境变量中添加 php 文件夹路径..... ;)
回答by Sergey Zimin
With PHP 7.2.4 and Apache 2.4.33 both installed on Windows 10x64 I got the same error: call to undefined function curl_init(). php.ini had extensions directory path and the php_curl extension defined and uncommented. Tried suggestions from earlier answers, no go.
在 Windows 10x64 上安装了 PHP 7.2.4 和 Apache 2.4.33 后,我遇到了同样的错误:调用未定义的函数 curl_init()。php.ini 有扩展目录路径和 php_curl 扩展定义和取消注释。尝试了早期答案中的建议,不行。
Fixed it by adding my PHP location to system PATH (as C:\php) and restarting httpd (Apache2.4 service in my case).
通过将我的 PHP 位置添加到系统路径(如 C:\php)并重新启动 httpd(在我的情况下为 Apache2.4 服务)来修复它。
回答by Tien Nguyen
Have 2 steps:
有2个步骤:
- Go to
php.ini
and remove;
in line;extension=curl
(in window). With Linux you can findcurl
to un-comment it. - I download internet 3 files:
libeay32.dll
,libssh2.dll
,ssleay32.dll
. And past to{Apache Folder}/bin
. Then restart apache.
- 转到
php.ini
并删除;
行;extension=curl
(在窗口中)。使用 Linux,您可以找到curl
取消注释。 - 我下载了互联网 3 个文件:
libeay32.dll
,libssh2.dll
,ssleay32.dll
. 和过去{Apache Folder}/bin
。然后重启apache。
You can refer this link if need https://www.php.net/manual/en/curl.installation.php
如果需要,您可以参考此链接https://www.php.net/manual/en/curl.installation.php
It is OK now.
现在可以了。