php curl nss initialize error -
i use php curl visit https website such "https://api.mch.weixin.qq.com" in php-fpm environment, code is:
<?php $ch = curl_init(); curl_setopt($ch, curlopt_timeout, 10); curl_setopt($ch, curlopt_url, 'https://api.mch.weixin.qq.com'); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_ssl_verifyhost, false); curl_setopt($ch, curlopt_header, false); curl_setopt($ch, curlopt_verbose, 1); $verbose = fopen('php://temp', 'w+'); curl_setopt($ch, curlopt_stderr, $verbose); curl_setopt($ch, curlopt_post, true ); curl_setopt($ch, curlopt_postfields, 'test'); $data = curl_exec($ch ); if ($data === false) { $error = curl_errno($ch) . ' ' . curl_error($ch); echo $error; rewind($verbose); $verboselog = stream_get_contents($verbose); echo "verbose information:\n<pre>", htmlspecialchars($verboselog), "</pre>\n"; } else { echo 'ok'; }
the verbose info is:
* connect() api.mch.weixin.qq.com port 443 (#0) * trying 101.226.129.200... * connected * connected api.mch.weixin.qq.com (101.226.129.200) port 443 (#0) * initializing nss certpath: sql:/etc/pki/nssdb * unable initialize nss database * initializing nss certpath: none * unable initialize nss * nss error -5925 * closing connection #0 * problem ssl ca cert (path? access rights?)
the above error not happend, , after restart php-fpm, ok.
what error? how solve it?
note: havent update centos os recently.
i found if move either 1 of these 2 file away, problem occured:
/usr/lib64/libsoftokn3.so /usr/lib64/libsqlite3.so.0
but these 2 file there.
my curl version is:
# curl --version curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 nss/3.15.3 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp features: gss-negotiate idn ipv6 largefile ntlm ssl libz
my os is:
linux web-www 2.6.32-431.el6.x86_64 #1 smp fri nov 22 03:15:09 utc 2013 x86_64 x86_64 x86_64 gnu/linux