Curl extension not working for php 7, Windows 7 and Apache 2.4

2

I've recently upgraded to php 7.1.31, starting from an installation of EasyPhp (Windows 7, x86). After installing the files and configuring the php.ini file, all is running well, except a problem with the curl extension:

**Fatal error: Uncaught Error: Call to undefined function curl_init()**

phpinfo() confirms that curl extension is missing.

After a number of verifications and tests:

  • This is not a problem of uncommented extension in php.ini (";extension=php_curl.dll" is correctly uncommented).
  • libeay32.dll, ssleay32.dll, libssh2.dll are in the right directory at the root of the /php directory (I also tried in the /system32 folder even it is a bad idea, but it doesn't work better)
  • php_curl.dll is in the /ext/ directory
  • There was no associated error or log found in the Windows Event Viewer
  • The windows PATH var contains the /php directory
  • The extension_dir path is correctly set in the php.ini file (all others extensions are working)
  • I've tried various versions of ssleay32.dll, ssleay32.dll and libssh2.dll, as I supposed one could be broken, but nothing changed.

Maybe an hint: I've checked the list of known extensions with the DOS php command line utility:

php -r "print_r(get_loaded_extensions())";

it returns a list of 41 extensions including curl and openssl! But, the same command in a php page (Apache 2.4):

echo "<pre>", print_r(get_loaded_extensions()), "</pre>";

return a list of 39 extensions, curl and openssl are missing.

The underlying php.ini file is the same as the one used for the php CLI and for the web page running with php/apache...

Another point, https://www.php.net/manual/en/curl.installation.php refer to libcrypto-.dll But libcrypto-.dll is not in the default download folder of php (why?). I test without success a libcrypto-.dll

Any idea would be greatly appreciated!

Michael

Posted 2019-09-12T15:47:45.140

Reputation: 21

Look at the output of phpinfo(); in both places (command prompt and through a web browser) paying particular attention to the value of the Loaded Configuration File value. You did say that they were the same but everything else you've said about the problem indicates that they are not. – Dave – 2019-09-13T11:20:48.560

Answers

0

I had a similar problem starting PHP 7.3 .

Before (at least on 7.2.3), setting extension_dir = "ext" worked fine. But on 7.3.14 or 7.4.2 this does not works. I had to fully set the path like so :

extension_dir = "C:\Program Files\Webserver\bin\PHP\7.4.2\ext"

I manage to find the problem by reading the apache error logs

grunk

Posted 2019-09-12T15:47:45.140

Reputation: 101