Connection to `ssl://pecl.php.net:443' failed: mac系统
敬告
经过我多次测试,发现就算按照以下做法换了证书,一样会偶尔出现“Operation timed out”,多试几次就好了...
错误
sudo pecl search mbstring
Connection to `ssl://pecl.php.net:443' failed: Operation timed out
解决步骤
php -r "print_r(openssl_get_cert_locations());"
会得到类似的结果,找到default_cert_file的路径
Array
(
[default_cert_file] => /usr/local/php5/ssl/cert.pem
[default_cert_file_env] => SSL_CERT_FILE
[default_cert_dir] => /usr/local/php5/ssl/certs
[default_cert_dir_env] => SSL_CERT_DIR
[default_private_dir] => /usr/local/php5/ssl/private
[default_default_cert_area] => /usr/local/php5/ssl
[ini_cafile] => /usr/local/php5/ssl/cert.pem
[ini_capath] =>
)
记住需要更换的证书的路径为 /usr/local/php5/ssl/cert.pem
wget http://curl.haxx.se/ca/cacert.pem (wget下载不了的话,请用浏览器下载)
sudo mv cacert.pem /usr/local/php5/ssl/cert.pem
sudo pecl search mbstring
No releases available for package "pecl.php.net/mbstring"
完成,没有错误提示了,显示能连接,可惜无法搜索到mbstring扩展
————————————————