openssl 扩展安装不正确导致https请求 segmentfault

$composer global require xx -vvv
Changed current directory to /Users/didi/.composer
Loading config file /Users/didi/.composer/config.json
Loading config file /Users/didi/.composer/auth.json
Reading /Users/didi/.composer/composer.json
Loading config file /Users/didi/.composer/config.json
Loading config file /Users/didi/.composer/auth.json
Loading config file /Users/didi/.composer/composer.json
Loading config file /Users/didi/.composer/auth.json
Reading /Users/didi/.composer/auth.json
Segmentation fault: 11



lldb -c 打开



openssl.so was compiled with optimization - stepping may behave oddly; variables may not be available.



  • thread #1: tid = 0x0000, 0x0000000108fbf1fe openssl.so`zif_openssl_x509_parse [inlined] php_openssl_add_assoc_asn1_string(val=0x0000000109022d90, key=, str=0xffffffffffffffff) at openssl.c:913, stop reason = signal SIGSTOP

    • frame #0: 0x0000000108fbf1fe openssl.so`zif_openssl_x509_parse [inlined] php_openssl_add_assoc_asn1_string(val=0x0000000109022d90, key=, str=0xffffffffffffffff) at openssl.c:913 [opt]






php installer –version=1.4.1



Some settings on your machine make Composer unable to work properly.



Make sure that you fix the issues listed below and run this script again:



The openssl extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with –with-openssl



cd PhpstormProjects/c/php-src/
make clean
./configure –with-openssl
make -j4
make install



$php installer –version=1.4.1
All settings correct for using Composer
Downloading…



Composer (version 1.4.1) successfully installed to: /Users/didi/PhpstormProjects/php/IDL/composer.phar
Use it: php composer.phar



问题解决




反思
问题原因,虽然openssl 扩展编译痛过了,但是由于环境原因,导致core



保险的方式是
重新brew install openssl
然后./configure –with-openssl



vi /usr/local/lib/php.ini



openssl.cafile=/usr/local/ssl/cert.pem
include_path=”.:/Users/didi/pear/share/pear”



扩展有两种方式
1,和php 源码一起编译
./configure –with-openssl
2,单独编译
so形式加入php.ini
需要注意的是openssl 需要配合一些其他配置



https://www.cnblogs.com/kenshinobiy/p/7412455.html
https://learnku.com/docs/php-internals/php7/building_extensions/6849


Category php