cURL issue with PHP 7.x on Apache 2.4 under Windows 10
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
Also in PHP.ini I set the extension_dir as an absolute path (eg: C:/Program Files/Php/ext/)
I had also already added the PHP folder to the Windows Path variable
But the cURL library was still missing. 😩
To verify this I used the classic…
but no traces of cURL.
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:
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