1

Not sure if this is best suited to SO or here.

I have an Apache 2.4 server running on Windows Server 2019 OS. I have installed PHP 8.1.29 from the Apache on Windows site and everything else about PHP seems to work OK.

I cannot get cURL to work. If I tried to use any PHP cURL functions, I get messages suggesting the function does not exist, implying the cURL has not been loaded. If I do a PHPinfo test to bring up the php info web page, I can see if has no cURL heading, so I know it's not getting loaded.

If I look in the php.ini file in C:\php\php.ini I can see that php_curl extension is listed here and not commented out. I can see on the PHPinfo page that this is the correct php.ini file that is being used by Apache.

If I look in the error logs, I can see the following line that is of interest:

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_curl' (tried: C:\\php\\ext\\php_curl (The specified procedure could not be found), ext\\php_C:\\php\\ext\\php_curl.dll (The specified module could not be found)) in Unknown on line 0 

the dll file in question is present in C:\php\ext\

The extension section of the php.ini file looks like this:

; Directory in which the loadable extensions (modules) reside. ; https://php.net/extension-dir ;extension_dir = "./" ; On windows: extension_dir = "ext" 

Which I think is correct.

I've tried setting the curl extension with the following line in the php.ini file: extension=C:\php\ext\php_curl

I've tried to set it to: extension=curl

and restarted after each time, it still won't load it with the same error:

PHP Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: ext\\curl (The specified module could not be found), ext\\php_curl.dll (The specified procedure could not be found)) in Unknown on line 0 

I've tried downloading php 8.2 and stealing the curl dll file and placing it in the same place, just encase the one from 8.129 is corrupt but that does not work either.

I found this thread on SO: https://stackoverflow.com/questions/12348/php-curl-on-windows-install-the-specified-module-could-not-be-found

And based on that I copied the 3 libssl-* files and 3 libcrypto-* files from the php folder into my system32 folder and restarted apache again, but still get the same error:

PHP Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: ext\\curl (The specified module could not be found), ext\\php_curl.dll (The specified procedure could not be found)) in Unknown on line 0 

This all started after I updated PHP from an older version of 8.1 to patch a published security exploit, it was working fine before that.

Edit to add: I already had the php installation folder in the environment variable PATH, so moving those files should not have been necessary anyway.

3
  • My first thought when I saw extension=C:\php\ext\php_curl is: shouldn’t that file name include a file name extension ? Something like extension=C:\php\ext\php_curl.dll? Commented Jun 14, 2024 at 11:48
  • 1
    I did try that as well, but I removed it because it resulted in the same error ext\\php_curl.dll.dll (The specified procedure could not be found)) but it put an extra '.dll' on the end like so, so I removed it. Commented Jun 14, 2024 at 12:12
  • I managed to fix this. I had to update Apache 2.4 to the latest version, then this problem just went away. Still not clear why. This SO question here gave me the idea to try this: stackoverflow.com/questions/57871765/… Commented Jun 14, 2024 at 13:47

1 Answer 1

0

I had the same problem. On two Windows servers with same versions of php and Apache, it worked on one but not on the other.

It turned out that one of the servers had the path to PHP binaries in the PATH variable. Adding it to the other server and restarting Apache fixed the problem.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.