Call to undefined function curl_init() error
Asked Answered
H

5

5

I am on a Win 64 bit OS, php 5.6.8 using Eclipse PDT to develop PHP.

I have come across this Call to undefined function curl_init() error.

I removed the ; preceeding extension=php_curl.dll in php.ini .Restarted the Apache server but still getting the same error.

Any hint where I am going wrong?

Handicap answered 24/4, 2015 at 4:21 Comment(6)
The IDE is not related. You can always check the extension status by phpinfo() function.Pinelli
php.ini exists in multiple places, did you edit the one that phpinfo() says its using?Jacinda
thanks a lot folks for your replies...i found that my ext dir was not set in php.ini ...so php_curl.dll was not loading up .i also had to install libssh2.dllHandicap
I have same problem @Handicap =(Kinesiology
@Kinesiology please check your ext dir property in php.ini file whether it is properly to the extension directoryHandicap
Here is a fix for Windows user running PHP 7+ https://mcmap.net/q/81439/-call-to-undefined-function-curl_init-error-in-wamp-2-2Glynda
W
24

I had the same issue and after hours, I found a message here :

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."

It worked for me.

Not easy to find, right ? :-)

Willable answered 11/8, 2015 at 16:6 Comment(7)
Copying the files helped out. I had an issue with upgrading from php5.6 to php7. Thanks!Corrigendum
This was my problem after upgrading to PHP 5.6.27 from PHP 5.6.19, thank you.Lysine
Worked for php7Catheterize
The statement "Apache libraries were outdated" saved me from hours of painful but fruitless labour. Adding libssh2.dll to libeay32.dll and ssleay32.dll did the magic.Thanks.Manic
After several hours this solved my problem. Adding apache/bin to PATH, adding PHP/ext to PATH none of them solved the problem.Bosomed
I copied those file but with no success; how can I know from which folder has Apache been started? I probably have multiple installations from the past...Sheehy
This was the right solution for me using EasyPHP Devserver 17.0 on Windows 10. Thanks!Roussel
M
5

Just add php folder path in PATH environment variable..... ;)

Menstrual answered 5/1, 2017 at 19:40 Comment(2)
I spent 8 hours of searching and after trying everything, finally, the problem is solved when I add the PHP folder path in PATH environment variables.Gynecium
I also had to restart the Windows PC completely for this solution for work with my XAMPP.Apathetic
P
4

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.

My answer in the Link ( Call to undefined function curl_init() even it is enabled in php7 ) says:

Your Filepath is probably incorrect

Check the Apache error log in

/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

/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
Pacifist answered 8/2, 2016 at 15:27 Comment(3)
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From ReviewChirrup
Thanks for the hint @MattO'Brien. I just did not want to spam around with copies.Pacifist
It is a situation where if the URL moves or the link goes dead...then the answer ends up worthless :)Chirrup
L
3

Have 2 steps:

  1. Go to php.ini and remove ; in line ;extension=curl (in window). With Linux you can find curl to un-comment it.
  2. I download internet 3 files: libeay32.dll, libssh2.dll, ssleay32.dll. And past to {Apache Folder}/bin. Then restart apache.

You can refer this link if need https://www.php.net/manual/en/curl.installation.php

It is OK now.

Laflam answered 15/10, 2019 at 15:29 Comment(0)
S
1

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.

Fixed it by adding my PHP location to system PATH (as C:\php) and restarting httpd (Apache2.4 service in my case).

Stickpin answered 16/4, 2018 at 3:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.