PHP 7 curl not being loaded

11,029

Solution 1

In my case it worked when I also copied nghttp2.dll to Apache bin directory

Solution 2

I was looking for a solution a really long time, until I decided to read some comments on the PHP documentation site: http://php.net/manual/de/curl.installation.php

I fixed coping the following list files from php folder (in my case C:\xampp\php7)

libeay32.dll
libssh2.dll
ssleay32.dll

Some people also had to move nghttp2.dll for it to work.

To your apache/bin folder (C:\xampp\apache\bin in my case).

I also copied those to C:\Windows\System32, but I do not think any of these files were loaded.

EDIT: I successfully deleted these dlls from system32 folder and was able to run curl afterwards

Solution 3

It works if you set ssl VERIFYPEER to false

curl_setopt($get, CURLOPT_SSL_VERIFYPEER, false);

it will works fine . you can also make curl work withe ssl by downloading the cacert.pem from https://curl.haxx.se/docs/caextract.html and Adding the cert to your php.ini file

curl.cainfo="C:\path\cacert.pem" 
openssl.cafile="C:\path\cacert.pem"

and

curl_setopt($get, CURLOPT_SSL_VERIFYPEER, true);

will work too this way you can prevent man-in-the-middle attacks, check this link for more details http://thisinterestsme.com/php-curl-ssl-certificate-error/

Share:
11,029

Related videos on Youtube

Pedro
Author by

Pedro

Updated on June 04, 2022

Comments

  • Pedro
    Pedro almost 2 years

    I have installed in my local computer apache 2.4 with PHP 7.1. I enabled curl in my php.ini (extension=php_curl.dll), but for some reason curl is not being loaded even after i enabled it, i made a phhinfo to check, and nothing, i also made a small script:

    function isExtensionLoaded($extension_name){
        return extension_loaded($extension_name);
    }
    
    echo isExtensionLoaded('curl');
    

    And nothing, is blank, what it means is not being loaded, is something missing? Im on Windows 10.

    • hassan
      hassan about 7 years
      make sure that you've restarted your apache2 server
    • Vural
      Vural about 7 years
      "blank" means, "its loading, but can't display" or "it throws error but error logging is not activated in php.ini" etc....
  • Pedro
    Pedro about 7 years
    Hello is giving me this error: "PHP Warning: PHP Startup: Unable to load dynamic library 'C:\PHP\ext\php_curl.dll"
  • Pedro
    Pedro about 7 years
    Its this: extension_dir = "C:\PHP\ext"
  • Vural
    Vural about 7 years
    Can you please check httpd.conf file, I guess mod_ssl.so is not installed and check my updated answer please
  • Pedro
    Pedro about 7 years
    Yes, i already enabled, it was comment and i remove the comment :LoadModule ssl_module modules/mod_ssl.so
  • Adam Cameron
    Adam Cameron over 6 years
    Those three and nghttp2.dll as well, for me. Cheers (also to @nick-proto)
  • Álvaro González
    Álvaro González almost 6 years
    I can't understand why third-party bundles are so popular yet you apparently always need to do workarounds like this for simple features. In the official PHP binaries curl always works out of the box :-?
  • Jerusalem Programmer
    Jerusalem Programmer about 2 years
    Thanks, bro! Your solution helped me with my overlapping problem here: https://stackoverflow.com/questions/71110013/how-to-enable-c‌​url-locally-on-my-wi‌​ndows-10-so-that-my-‌​php7-localhost-with-‌​or-w?