在使用composer update 更新包时,报错
The openssl extension is required for SSL/TLS protection but is not available. If you can not enable the openssl extension, you can disable this error, at your own ris
k, by setting the 'disable-tls' option to true.
发现在cli 命令行看不到openssl 扩展,但在浏览器phpinfo() 可以看到;
1. 没有出现的原因是:执行时添加上php.ini的文件就可以了
$ /usr/local/php/bin/php -c /usr/local/php/etc/php.ini -m | grep cb //cb是模块名
php -c /usr/local/php8/etc/php.ini -m|grep openssl
2. $ /usr/local/php/bin/php --ini | grep Configuration
把php.ini文件复制一份到这个目录下就可以了
将php.ini 复制到 /usr/local/lib 目录下
cp /usr/local/php8/etc/php.ini /usr/local/lib/php.ini
重启php-fpm
附加:我使用上边方法已成功。下边方法没测试
今天使用composer update发现报错:The openssl extension is required for SSL/TLS protection but is not available
网上很多人说开启“extension = php_openssl.dll”,事实上我的已经是开启的,错误依旧提示。废话不说了
本地开发,我是关闭Composer的TLS来修复,注意:它不安全
composer config -g -- disable-tls true
同时开启php.ini中的
extension=openssl
特别提醒:
如果设置为true,则将使用HTTP尝试所有HTTPS URL,而不执行网络级加密。启用这是一个安全风险,不推荐。更好的方法是在php.ini中启用php_openssl和openssl扩展。
参考:https://blog.51cto.com/u_15061951/3483915