Home > other >  Calling undefined curl_init() function in IIS
Calling undefined curl_init() function in IIS

Time:08-16

I have IIS 10 and my program calls curl_init function to make API calls. But I get this error: "Call to undefined function curl_init()" . Also when I look at the output of phpinfo() there is no cURL section showed up.

I've triple checked the php.ini file for extension=curl and ext folder for php_curl.dll. I also downloaded ssleay32.dll libeay32.dll files to system32 folder in C:. I restarted the server a couple of time. Still, when I check the phpinfo() there is no curl section there.

Here is what I have found in StackOverflow:

similar error

joshjdevl's answer may be the solution but what is the difference between thread-safe and non-thread-safe PHP package

Why does it work ?

about enabling curl extension here it is said that one should "add paths of your PHP directory to the Windows Environment PATH Variable for .dll dependencies." but in my local machine-my another machine-(with wampserver) I didn't add PHP to environment variables and it works, so do I really need to do that?

about making sure the system uses the correct php.ini file When I look at the phpinfo output I can see the path of the php.ini file. Based on that I assume IIS uses that php.ini file. I don't expect it to use another one.

about installing curl extension

I have searched more than 30 StackOverflow pages and still do not have a solution.

CodePudding user response:

After 8 hours of search and tens of StackOverflow questions, I've finally added the PHP path to environment variables and in the output of phpinfo() method cURL section started being shown and the error disappeared.

Windows Start -> Edit the system environment variables -> Advanced -> Environment Variables -> New..

For a more detailed explanation and for screenshots

But still have no idea why it works properly even though I didn't add PHP paths to Environment variables in my local machine. I assume it may be about wampserver configurations.

  • Related