cURL issue with PHP 7.x on Apache 2.4 under Windows 10

Andrea Mescalchin
2 min readAug 17, 2021

I have been working with PHP in various settings (both Linux and Windows) for several years but this time I had a really weird problem with PHP’s cURL library.

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

After doing a fresh install of PHP (7.4) on Apache 2.4 it still didn’t see the cURL library correctly.

Of course I had already uncommented the curl line from the extension section of PHP.ini

Lib curl enabled

Also in PHP.ini I set the extension_dir as an absolute path (eg: C:/Program Files/Php/ext/)

On Windows it is recommended to set it like this

I had also already added the PHP folder to the Windows Path variable

PHP folder in PATH

Apache restarted

Apache Service Monitor

But the cURL library was still missing. 😩

To verify this I used the classic…

<?phpphpinfo();

but no traces of cURL.

Me with a headcache

Only after a few hours I discovered that the reason for this lack is that Apache was unable to load the libraries necessary for the functioning of cURL (libcrypto-1_1-x64.dll e libssl-1_1-x64.dll).

At that point I edited the httpd.conf and added the following lines:

New lines to httpd.conf
LoadFile “E:/Program Files/Php/libcrypto-1_1-x64.dll”
LoadFile “E:/Program Files/Php/libssl-1_1-x64.dll”

After adding these two magic lines and after restarting Apache finally in my phpinfo() I found the curl library

Finally, it’s work!

🎉🎉🎉

--

--