php curl https

General support questions
Post Reply
www2
Posts: 7
Joined: 2017/12/04 22:15:47

php curl https

Post by www2 » 2018/03/15 13:15:54

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

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: php curl https

Post by avij » 2018/03/15 13:26:21

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."

www2
Posts: 7
Joined: 2017/12/04 22:15:47

Re: php curl https

Post by www2 » 2018/03/15 13:37:33

I used any combination of settings and no works

www2
Posts: 7
Joined: 2017/12/04 22:15:47

nssdb why it need?

Post by www2 » 2018/03/16 16:33:08

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?

Post Reply