I am aware that there are other questions with a similar title, such as the following:
curl_init() function not working
However I am still not able to get curl working on my localhost and on my server.
For this case, I will focus on the server, which is a Windows Server 2019.
The version of Apache is 2.4.46.
The version of PHP is 7.4.12.
In the php.ini file, I have the following uncommented:
extension=curl
In the extension folder, I can see the following file:
php_curl.dll
On the phpinfo.php page, I don't see that curl has been enabled, which is strange. The only place I see curl is in the module.authors section, and it looks like this:
cURL | Sterling Hughes
I have already restarted the services, but I am still getting the following error:
Fatal error: Uncaught Error: Call to undefined function curl_init()
What am I doing wrong and how can I fix this?
I just added this piece of code:
echo "<pre>", print_r(get_loaded_extensions()), "</pre>";
And I get the following:
Array
(
[0] => Core
[1] => bcmath
[2] => calendar
[3] => ctype
[4] => date
[5] => filter
[6] => hash
[7] => iconv
[8] => json
[9] => SPL
[10] => pcre
[11] => readline
[12] => Reflection
[13] => session
[14] => standard
[15] => mysqlnd
[16] => tokenizer
[17] => zip
[18] => zlib
[19] => libxml
[20] => dom
[21] => PDO
[22] => openssl
[23] => SimpleXML
[24] => xml
[25] => xmlreader
[26] => xmlwriter
[27] => apache2handler
[28] => mysqli
[29] => Phar
[30] => pdo_mysql
)
1
None of which are for curl.
I was able to finally solve this issue by finding a file in my PHP root folder called libssh2.dll and copy/paste into the Apache bin folder. Once I did that, curl is now enabled, and I no longer get the error in question. I'm getting other errors, but that's for another question.