'Enable cURL on PHP7 windows10 64 bit Apache 2.4

I am using Windows10 64 bit Apache 2.4.25 (Win64) PHP 7.1.0-Win32-VC14-x64

when i try calling curl_init() function, i get an error saying "Call to undefined function curl_init()" tried following

  • copying ssleay32.dll & libeay32.dll & php7ts.dll to apache/bin folder
  • setting path properly to include above files "C:/PHP;"

Any help much appreciated.



Solution 1:[1]

Here are the steps from obtaining PHP to enabling cURL:

  1. Download PHP (these steps tested with 7.1)
  2. Add PHP folder to PATH environment variable
  3. Update php.ini file with absolute path for extension directory and uncomment php_curl.dll and php_openssl.dll extensions
  4. Update httpd.conf (Apache config file) to load php7apache2_4.dll module in PHP folder and set PHPIniDir to PHP directory
  5. Copy libeay32.dll libssh2.dll and ssleay32.dll into apache/bin (replace existing)
  6. Restart Apache.

Solution 2:[2]

I fixed it by:

1)Edit php.ini file Enable( uncomment) php_curl.dll and php_openssl.dll extensions

2)go to c:/php7/

Copy libssh2.dll into c:/apache24/bin folder.

3) test by: curl_test.php

<?php

// Script to test if the CURL extension is installed on this server

 // Define function to test
    function _is_curl_installed() {
if  (in_array  ('curl', get_loaded_extensions())) {
    return true;
}
else {
    return false;
}
}

// Ouput text to user based on test
 if (_is_curl_installed()) {
    echo "cURL is <span style=\"color:blue\">installed</span> on this server";
  } else {
  echo "cURL is NOT <span style=\"color:red\">installed</span> on this server";
}
?>

Solution 3:[3]

in PHP 7.2.2 Windows 10 Apache 2.4 After a while of searching for answers why the cURL library doesn´t load, i just copied libssh2.dll from \php to \Apache24\bin and everything started to work just fine

Solution 4:[4]

I had the same issue with Acquia's Dev Desktop, copying the libcrypto-1_1-x64.dll and libssl-1_1-x64.dll from the PHP7.3 folder to the Apache/bin folder resolved the issue for me.

"Beginning with version 1.1.0 OpenSSL did change their libary names! libeay32.dll is now libcrypto-.dll (e.g. libcrypto-1_1-x64.dll for OpenSSL 1.1.x on 64bit windows) ssleay32.dll is now libssl-.dll (e.g. libssl-1_1-x64.dll for OpenSSL 1.1.x on 64bit windows)"

  • epos_jk

See https://www.php.net/manual/en/curl.installation.php#121921.

Solution 5:[5]

Here is what worked for me...

Env Info

  • WAMP Server version 3.1.9
  • Apache 2.4.39
  • PHP 7.2.18

Step 1

From PHP downloads, I got VC15 x64 Thread Safe (2019-May-01 10:48:48) https://windows.php.net/download#php-7.2

Step 2

Extracted the zip file and copied /ext/php_curl.dll to C:\wamp64\bin\php\php7.2.18\ext directory (By overwriting)

Step 3

Restarted all services

DONE

Solution 6:[6]

After spending countless hours or even days trying out all the posted solutions on stackoverflow and elsewhere, the only thing that worked for me in 2022 was the following solution, (taken from this comment to the php cURL manual)

Try add to these strings to apache config (httpd.conf):

# manually load SSL libraries for cURL
LoadFile "(path\to\php)\libssh2.dll" 
LoadFile "(path\to\php)\libcrypto-1_1-x64.dll" 
LoadFile "(path\to\php)\libssl-1_1-x64.dll"

and restart apache (dont forget to use your php folder name);

Don't know if this matters, but I am on Windows 7, using Apache 2.4 and PHP 7.4. I don't have any WAMP/XAMP server installed on my system. Instead I downloaded the ZIPped versions and start them manually from my local non-system drive whenever I need to use localhost.

Also, after it finally worked, I deleted libeay32.dll, ssleay32.dll from C:/Windows/System32 and from Apache/bin.

Solution 7:[7]

This save my life (from https://www.php.net/manual/en/curl.installation.php)

Upgrading to php 7.1.6 on Apache 2.4 32bit version Windows 7 x64

this curl implementation works:

  1. C:/(path to php folder)/php.ini enable extension=php_curl.dll

libeay32.dll, ssleay32.dll, libssh2.dll find directly in php7 folder

  1. add this to Apache/conf/httpd.conf
    # load curl and open ssl libraries  
    LoadFile "C:/(path to php folder)/libeay32.dll"  
    LoadFile "C:/(path to php folder)/ssleay32.dll"
    LoadFile "C:/(path to php folder)/libssh2.dll" 
    

If you don't find some of this DLLs, try downloaidng non-TS version fo php and copy them from that folder.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bnp887
Solution 2 hoogw
Solution 3 Carlos
Solution 4
Solution 5 Zortext
Solution 6 dominman
Solution 7 dominman