当前位置: 首页 > article >正文

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'


http://www.kler.cn/news/336043.html

相关文章:

  • Vue/组件的生命周期
  • 【数据结构】【队列】算法汇总
  • 电脑提示d3dcompiler_47.dll缺失怎么修复,仔细介绍dll的解决方法
  • netty之Netty与SpringBoot整合
  • JavaScript进行数据可视化:D3.js入门
  • MySQL 和 Elasticsearch 的应用场景
  • 腾讯云技术深度解析:构建高效云原生微服务架构与AI创新实践
  • EPC User Manual Introduction
  • 矩阵消元的LU分解——解法及为什么这样做
  • 【游戏模组】星际争霸1代模组燃烧之地,泰伦帝国对决UED。特效华丽兵种巨多特别好玩
  • 开源软件简介
  • 【算法篇】回溯算法类(2)(笔记)
  • Docker 安装与配置单机多磁盘 MinIO:高效存储解决方案
  • Spring Boot新闻推荐系统设计与实现
  • 使用Spring Boot与AnalyticDB结合通义千问API实现智能PPT生成功能
  • 【AI论文精读1】针对知识密集型NLP任务的检索增强生成(RAG原始论文)
  • Pikachu-xss防范措施 - href输出 js输出
  • 新160个crackme - 076-ArturDents-CrackMe#1
  • 二分解题的奇技淫巧都有哪些,你还不会吗?
  • 鸿蒙next开发者第一课02.DevEcoStudio的使用-习题