PHP使用file_get_contents或curl请求https的域名均会发生segment fault的错误。
问题PHP代码如下,执行该PHP命令会发生segment fault:
var_dump(file_get_contents("https://www.baidu.com"));
解决方案:
1. 升级你的PHP版本,在5.4环境下,未能重现改问题(以上执行代码是PHP5.2)
2. Sadly, this has not been the case. Removing /etc/pki/nssdb/pkcs11.txt and /etc/pki/nssdb/cert9.db seem to be the key, here. :-((Centos bugs上提供的解决方案,实践后 可行,但是删掉了不久后会重新出现)
PHP版本:
PHP 5.2.14 (cli) (built: Jul 3 2016 23:56:15)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
with eAccelerator v1.0-dev, Copyright (c) 2004-2012 eAccelerator, by eAccelerator
<