php获取远程https内容时提示PHP Warning: copy(): Unable to find the wrapper “https“ 解决方法
异常信息:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
PHP Warning: copy(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in Command line code on line 1
PHP Stack trace:
PHP 1. {main}() Command line code:0
PHP 2. copy($source_file = 'https://getcomposer.org/installer', $destination_file = 'composer-setup.php') Command line code:1
Warning: copy(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in Command line code on line 1
Call Stack:
0.0001 388024 1. {main}() Command line code:0
0.0008 388024 2. copy($source_file = 'https://getcomposer.org/installer', $destination_file = 'composer-setup.php') Command line code:1
异常原因
这个异常是因为当前的php没有配置openssl模块, 所以在php访问https的内容时就提示 Unable to find the wrapper "https" 异常。
解决方法: 安装 openssl扩展
在macos中通过macport安装php后,默认是没有安装openssl扩展的, 需要我们手动安装一下这个openssl的扩展。
# 首先确定当前php版本 php -version # 然后安装 openssl扩展 , 这里以php7.2版本为例 sudo port install php72-openssl
如果你的php非port安装的,解决方法也是一样的,安装对应php的 openssl 扩展即可。
通过port search查找可用的php openssl扩展包参考
命令: port search --name --line --regex '^php(d+)-openssl'
以上就是php获取远程https内容时提示PHP Warning: copy(): Unable to find the wrapper "https" 解决方法的详细内容,更多关于php获取https提示Unable to find的资料请关注科站长其它相关文章!
栏 目:PHP编程
本文标题:php获取远程https内容时提示PHP Warning: copy(): Unable to find the wrapper “https“ 解决方法
本文地址:https://www.fushidao.cc/wangluobiancheng/3365.html
您可能感兴趣的文章
- 02-10windows服务器iis+php获得错误信息的配置方法
- 02-09通过PHP接入DeepSeek API的两种方法
- 02-07PHP调用DeepSeek API的完整指南
- 02-06PHP foreach引用变量导致的问题及其解决方案
- 02-02PHP使用puppeteer抓取JS渲染后的页面内容
- 01-17PHP SM4加密的实现
- 01-17PHP实现用户认证与权限管理的实现
- 01-10ThinkPHP中跨域请求设置的几种方式
- 01-09ThinkPHP中的接口的安全防护措施小结
- 01-03在ThinkPHP中实现文件上传的实用示例


阅读排行
推荐教程
- 11-23PHP 7安装使用体验之性能大提升,兼容性强,扩展支
- 11-22PHP自定义函数判断是否为Get、Post及Ajax提交的方法
- 11-23php中 == 和 === 的区别和应用说明
- 11-23隐藏PHP版本与PHP基本安全设置
- 11-23PHP+MYSQL 读写分离简单实战
- 11-22详解PHP防止直接访问.php 文件的实现方法
- 11-22PHP编程求最大公约数与最小公倍数的方法示例
- 11-22PHP实现上传多图即时显示与即时删除的方法
- 11-23PHP保留两位小数的几种方法
- 11-23nginx+php 打开php错误提示的方法