Zend-Server 8.5,未设法更新 OpenSSL for PHP


Zend-Server 8.5, not managed to update OpenSSL for PHP

对这个主题进行了非常广泛的调查,但仍然没有设法强制新版本的OpenSSL在OSX El Capitan上与ZendServer v.8.5.2一起使用。

前史:默认情况下,ZendServer 和 El Capitan 似乎使用 openssl-0.9.8zc。PHP 5.6.15的新版本不能在此版本的OpenSSL和Composer-PHP中正常工作。我收到错误:

找不到有效的 CA 证书文件。您必须设置有效的"cafile"选项。 SSL/TLS 保护需要有效的 CA 证书文件。 ...

[作曲家''下载器''传输异常]
配置的ca文件无效或无法读取。

我用Brew更新了OpenSSL的版本,然后确保它在系统中正确注册:

 brew unlink openssl && brew link --force openssl

但实际上,ZendServer 似乎在二进制目录中有自己的 openssl lib 本地副本:

/

usr/local/zend/bin/openssl

openssl.cafile是空的,所以我决定将其指向新路径,因为它在一些教程中是推荐的:usr/local/etc/openssl/cert.pem

结果:

系统似乎指向OpenSSL的正确版本:

$ openssl version
OpenSSL 1.0.2f  28 Jan 2016
$ openssl version -d
OPENSSLDIR: "/usr/local/etc/openssl"

同时which指向zend的OpenSSL版本:

$ which -a openssl
/usr/local/zend/bin/openssl
/usr/local/bin/openssl
/usr/bin/openssl

PHP似乎仍然具有的默认配置,通过我的系统中不再存在的路径:

$ php -i | grep openssl
Configure Command =>  './configure'  '--prefix=/usr/local/zend' '--with-config-file-path=/usr/local/zend/etc' '--with-config-file-scan-dir=/usr/local/zend/etc/conf.d' '--disable-debug' '--enable-inline-optimization' '--disable-all' '--enable-libxml' '--enable-session' '--enable-spl' '--enable-xml' '--enable-hash' '--enable-reflection' '--with-pear' '--with-apxs2=/usr/local/zend/apache2/bin/apxs' '--with-layout=GNU' '--enable-filter' '--with-pcre-regex' '--with-zlib' '--enable-simplexml' '--enable-dom' '--with-libxml-dir=/usr/local' '--with-openssl=/usr/local/openssl-0.9.8zc' '--enable-pdo' '--with-pdo-sqlite' '--with-pdo-mysql=mysqlnd' '--with-libedit' '--with-pdo-pgsql' '--with-iconv' '--with-sqlite3' '--disable-phar' '--enable-xmlwriter' '--enable-xmlreader' '--enable-mysqlnd' '--enable-json' 'CC=gcc' 'CFLAGS=-fPIC '-O2' '-pipe' '-g' '-fno-common' '-g'' 'CPPFLAGS=-fPIC 'CXXFLAGS=-fPIC 'CXX=g++' 'LDFLAGS='
openssl
Openssl default config => /usr/local/openssl-0.9.8zc/ssl/openssl.cnf
openssl.cafile => /usr/local/etc/openssl/cert.pem => /usr/local/etc/openssl/cert.pem
openssl.capath => no value => no value

我还没有找到任何方法可以更改Zend Server 8.5.2中PHP的默认Zend的OpenSSL配置,并将其指向OSX中新的OpenSSL。

作曲家仍然抛出相同的错误并且不起作用。我在这里和那里抓取了StackOverflow,但没有找到解决方案,这在我的情况下有效。任何帮助将不胜感激。

谢谢!


回答我自己:似乎,当PHP编译时,这些库内置于PHP中,因此除非重新编译PHP,否则升级SSL库文件不会产生任何影响。听起来,没有办法在ZendServer中更新OpenSSL库,除非下载较新的版本(没有更新的版本)。

经过几天的调查,如果不重新编译PHP和库,似乎就无法在ZendServer中更新OpenSSL的PHP。所以这个问题似乎是无法回答的。没有简单的方法可以做到这一点。您仍将拥有OpenSSL的系统版本,这与使用PHP预编译的版本不同。

我放弃了一个在ZendServer中升级OpenSSL的想法,因为它内置于PHP本身。相反,我回滚了我的配置和ZendServer设置,所以它至少以某种方式工作,使用旧版本的OpenSSL。


在某些情况下,它也可能有所帮助,无需重新安装:手动更新证书

  1. 从 http://curl.haxx.se/ca/cacert.pem 下载cacert.pem
  2. cacert.pem复制到'/usr/local/zend/etc/ssl/certs/'
  3. 修改 CURL 配置(Zend Server Configuration -> PHP -> CURL)并更改:

curl.cainfo = '/usr/local/zend/etc/ssl/certs/cacert.pem'

  1. 重新启动 PHP 并检查 CURL 是否可以从 HTTPS URL 读取。

有关详细信息,请参阅修复 Mac OS X 上过期的中间证书一文