Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 391
Sonic Avatar asked Jan 24 '17 05:01

Sonic


4 Answers

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.
like image 148
bnp887 Avatar answered Nov 08 '22 00:11

bnp887


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";
}
?>
like image 41
hoogw Avatar answered Nov 07 '22 22:11

hoogw


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

like image 12
Carlos Avatar answered Nov 07 '22 22:11

Carlos


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.

like image 5
deronimo Avatar answered Nov 08 '22 00:11

deronimo