我最近将本地OS X Zend Server安装更新为PHP 5.6,并且在运行composer self-update时收到以下错误消息:
[Composer\Downloader\TransportException] The "https://getcomposer.org/version" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed Failed to enable crypto failed to open stream: operation failed
到处搜寻,我终于得出结论,PHP 5.6中对SSL进行了各种改进,问题是它在我的系统上找不到任何OpenSSL证书。这并不完全令人惊讶,因为OS X不再使用内部使用OpenSSL而是使用其自己的库。
有一个新的PHP函数openssl_get_cert_locations对此有所帮助,因此我运行了:
php -r "print_r(openssl_get_cert_locations());"
输出信息:
Array ( [default_cert_file] => /usr/local/openssl-0.9.8zb/ssl/cert.pem [default_cert_file_env] => SSL_CERT_FILE [default_cert_dir] => /usr/local/openssl-0.9.8zb/ssl/certs [default_cert_dir_env] => SSL_CERT_DIR [default_private_dir] => /usr/local/openssl-0.9.8zb/ssl/private [default_default_cert_area] => /usr/local/openssl-0.9.8zb/ssl [ini_cafile] => [ini_capath] => )
我的系统上没有目录/usr/local/openssl-0.9.8zb,并且没有定义SSL_CERT_FILE和SSL_CERT_DIR,因此报错也就不足为奇了。
要修复它,我通过自制软件安装openssl:
brew install openssl
这会将openssl证书安装到/usr/local/etc/openssl/cert.pem,因此我们现在可以使用新的PHP 5.6 INI设置openssl.cafile告诉PHP在哪里可以找到证书:
php.ini配置如下:
openssl.cafile=/usr/local/etc/openssl/cert.pem
<!doctype html> <html> <head> <meta charset="utf-8"> <title>demo</title> </head> <bod...
//参数1 文件名 参数2 缩放比例 function _thumb($_filename,$_percent){ ob_clean();...
先在centos安装openssl,然后开始://生成私钥openssl genrsa -out rsa_private_key.pem 1024//生成公钥openssl rsa -in rsa_private_key.pem&...
经常我们下载国外资源容易被墙,可以通过php脚本获取远程文件流然后输出给我们的浏览器来下载。<?php //设置下载文件的url $url = 'https://mirrors.huaweicloud.com/ubuntukylin/ubuntukylin-19....
概念请参考w3school文章: redis watch ,redis exec (看完基本秒懂)(1)基本事务://连接本地的 Redis 服务 $redis = new Redis(); $redis->con...
最近在项目中处理一个关于商品数据重复需要删除多余的商品记录,但是删除一条商品必然要把关联的其他表商品的id和其他商品信息更换为正确的,删除一个商品记录,同时要去修改100多张表的关联商品数据,在项目中引用了tp orm 1.2版本,由于项目是php5.6版本,没法使用最新orm,在代码中每处理1个商...