Reputation: 3065
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.
Upvotes: 2
Views: 4242
Reputation: 1
Faced with the same problem with PHP 8.3.10 and Apache 2.4.62. Enabling the curl extension is not solve the problem. By adding this line to the end of Apache configuration (httpd.conf), I solved the problem:
LoadFile "${SRVROOT}/php/libssh2.dll"
or
LoadFile "<apache path>/php/libssh2.dll"
Only this file is needed.
Upvotes: 0
Reputation: 1
Had a similar problem. My PHP 8.2-curl was installed, but somewhere 8.3 was upgraded, and 8.3-curl didn't get installed.
It worked when I uninstalled 8.3 and 8.2 and reinstalled PHP from scratch.
Upvotes: 0
Reputation: 3065
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.
Upvotes: 4