php獲取遠程https內(nèi)容時提示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的內(nèi)容時就提示 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內(nèi)容時提示PHP Warning: copy(): Unable to find the wrapper “https“ 解決方法的詳細內(nèi)容,更多關于php獲取https提示Unable to find的資料請關注腳本之家其它相關文章!
相關文章
PHP中auto_prepend_file與auto_append_file用法實例分析
這篇文章主要介紹了PHP中auto_prepend_file與auto_append_file用法,較為詳細的講述了配置信息的休息以及函數(shù)的用法和注意事項,需要的朋友可以參考下2014-09-09php提示W(wǎng)arning:mysql_fetch_array() expects的解決方法
這篇文章主要介紹了php提示W(wǎng)arning:mysql_fetch_array() expects的解決方法,是一個比較典型的php程序錯誤排查案例,具有一定的參考借鑒價值,需要的朋友可以參考下2014-12-12WordPress中用于獲取文章信息以及分類鏈接的函數(shù)用法
這篇文章主要介紹了WordPress中用于獲取文章信息以及分類鏈接的函數(shù)用法,分別是get_post()和get_category_link()的使用,需要的朋友可以參考下2015-12-12PHP實現(xiàn)根據(jù)設備類型自動跳轉(zhuǎn)相應頁面的方法
這篇文章主要介紹了PHP實現(xiàn)根據(jù)設備類型自動跳轉(zhuǎn)相應頁面的方法,是非常實用的功能,需要的朋友可以參考下2014-07-07PHP中的排序函數(shù)sort、asort、rsort、krsort、ksort區(qū)別分析
在php中自帶了大量了數(shù)組排序函數(shù),下面我們一一來介紹一下關于php數(shù)組排序的用法吧。2014-08-08