Pedro
Pedro

Reputation: 1477

PHP 7 curl not being loaded

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.

Upvotes: 3

Views: 12184

Answers (5)

Snoopy Ohoo
Snoopy Ohoo

Reputation: 109

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/

Upvotes: 1

Deividas Šimas
Deividas Šimas

Reputation: 184

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

Upvotes: 7

Nick Proto
Nick Proto

Reputation: 141

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

Upvotes: 10

Vural
Vural

Reputation: 8748

It hard to guess why its not running and as I see you don't get error atm.

you should get errors but I am pretty sure you didn't set error-logging in your php.ini

First we need to activate logging to see why your extensions are not running correctly:

Please change/add following lines in your php.ini file:

display_startup_errors = On
error_log = 'c:/php-logs/php-error.log'

Now create the php-logs directory and php-log.log file

mkdir c:/php-logs
copy NUL c:/php-logs/php-error.log

Now restart the server. Now you should get the errors and please share the error-code so I can help

Update:

Enable mod_ssl in `httpd.conf``

LoadModule ssl_module c:\apache-2.2\modules\mod_ssl.so

Upvotes: 0

Ion Bazan
Ion Bazan

Reputation: 838

Make sure you have edited the right file. There should be separate file for CLI, Apache2 and other SAPIs. After doing so, restart the Apache2 server.

Upvotes: 0

Related Questions