简体   繁体   English

调用未定义的函数 curl_init() 错误

[英]Call to undefined function curl_init() error

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. extension=php_curl.dll in php.ini .Restarted Apache 服务器但仍然得到相同的错误。

Any hint where I am going wrong?任何提示我哪里出错了?

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.dlllibssh2.dllssleay32.dllc:\\xampp\\apache\\bin (或您的apache\\bin路径),重新启动 Apache 并正常工作, Apache 的库已经过时了。”

It worked for me.它对我有用。

Not easy to find, right ?不容易找到吧? :-) :-)

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 eg如果被调用的路径或文件名与您的真实路径匹配,例如

/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

只需在 PATH 环境变量中添加 php 文件夹路径..... ;)

Have 2 steps:有2个步骤:

  1. Go to php.ini and remove ;转到php.ini并删除; in line ;extension=curl (in window).在线;extension=curl (在窗口中)。 With Linux you can find curl to un-comment it.在 Linux 中,您可以找到curl来取消注释。
  2. I download internet 3 files: libeay32.dll , libssh2.dll , ssleay32.dll .我下载了互联网 3 个文件: libeay32.dlllibssh2.dllssleay32.dll And past to {Apache Folder}/bin .然后转到{Apache Folder}/bin Then restart apache.然后重启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.现在可以了。

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().在 Windows 10x64 上安装了 PHP 7.2.4 和 Apache 2.4.33 后,我遇到了同样的错误:调用未定义的函数 curl_init()。 php.ini had extensions directory path and the php_curl extension defined and uncommented. php.ini 有扩展目录路径和 php_curl 扩展定义和取消注释。 Tried suggestions from earlier answers, no go.尝试了早期答案中的建议,不行。

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 服务)来修复它。

添加适合我的路径。在我的情况下,请使用wamp,因此将其添加为C:\\ wamp64 \\ bin \\ php \\ php7.2.18

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

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