Page 1 of 1

php curl https

Posted: 2018/03/15 13:15:54
by www2
hi
try to open site by https but got error

Code: Select all

Initializing NSS with certpath: sql:/etc/pki/nssdb
* Unable to initialize NSS database
* Initializing NSS with certpath: none
* Unable to initialize NSS
* Closing connection 0 
the code

Code: Select all

$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
//curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
//curl_setopt($ch, CURLOPT_CAINFO, 'cacert.pem');
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$returnInfo = curl_exec($ch); 

Code: Select all

php -i | grep SSL
SSL => Yes
SSL Version => NSS/3.28.4
PHP Warning: Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.2k-fips 26 Jan 2017
OpenSSL Header Version => OpenSSL 1.0.2k-fips 26 Jan 2017
Native OpenSSL support => enabled
how can fix it?
on ubuntu code works

Re: php curl https

Posted: 2018/03/15 13:26:21
by avij
Forcing the use of SSLv3 with curl_setopt($ch, CURLOPT_SSLVERSION, 3); is probably not a good idea. The documentation states that "Your best bet is to not set this and let it use the default."

Re: php curl https

Posted: 2018/03/15 13:37:33
by www2
I used any combination of settings and no works

nssdb why it need?

Posted: 2018/03/16 16:33:08
by www2
here is my problem viewtopic.php?f=47&t=66405
I deleted folder /etc/pki/nssdb and it start work
but not sure is this correct solution?
is nssdb necessary?