无法找到包装器“https"- 您是否在配置 PHP 时忘记启用它? [英] Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?

查看:33
本文介绍了无法找到包装器“https"- 您是否在配置 PHP 时忘记启用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题出在问题上.我已经对这方面的解决方案进行了彻底的调查,我知道有一些主题,我也遵循了它们,但没有任何效果.话虽如此,我将列出迄今为止我所做的一切.我在 Windows XP 计算机上的最新 Eclipse 版本上运行 PHP 5.2.14 和 Zend 调试.我有 1 GB 的 RAM.我在安装了 Apache、MySQL 和 FileZilla 的情况下运行了 XAMPP.

The problem is in the question. I've done a thorough investigation for solutions in regards to this and I know there are topics to this and I've followed them too and nothing has worked. That being said I'll list out exactly everything I've done so far. I am running PHP 5.2.14 with Zend Debugging on the latest Eclipse version on my Windows XP computer. I have a 1 GB of RAM. I have XAMPP running with Apache, MySQL, and FileZilla installed.

在 XAMPP 上,我完成了以下操作(Apache 在这些更改期间关闭):从 XAMPP 控制面板单击 Admin 并转到 https://localhost/xampp/.从那里我接受了欢迎页面上这一行的证书:

On XAMPP I've done the following (Apache was off during these changes): Clicked on Admin from the XAMPP Control Panel and went to https:// localhost/xampp/. From there I accepted the certs from this line on the welcome page:

对于 OpenSSL 支持,请使用带有 https://127.0.0.1 或 https://localhost 的测试证书.

For OpenSSL support please use the test certificate with https:// 127.0.0.1 or https:// localhost.

在同一部分,我检查了 phpinfo().在环境"下,SERVER["HTTPS"]on.在Apache 环境"下,HTTPSOn.在PHP 变量"下,_SERVER["HTTPS"]On.在Phar"下,OpenSSL supportdisabled(安装 ext/openssl).我不知道如何启用 Phar one.

On that same section I checked phpinfo(). Under 'Environment', SERVER["HTTPS"] is on. Under 'Apache Environment', HTTPS is On. Under 'PHP Variables, _SERVER["HTTPS"] is On. Under 'Phar', OpenSSL support is disabled (install ext/openssl). I don't know how to enable the Phar one.

现在关于 C:\xampp 中的文件本身,我转到 PHP 文件夹.在生产和开发 php.ini 文件(总比抱歉更安全)下,我有 allow_url_fopen=Onallow_url_include=On,并且我删除了分号,以便 extension=php_openssl.dll 不再被注释掉.我什至确认 .dll 位于 PHP 文件夹的 ext 文件夹中.libeay32.dll 和 ssleay32.dll 都在 PHP 和 Apache 文件夹中.Apache 文件夹不包含生产或开发 php.ini 文件.

Now regarding the files themselves in C:\xampp, I went to the PHP folder. Under both production and development php.ini files (better safe than sorry), I have allow_url_fopen=On, allow_url_include=On, and I removed the semicolon, so that extension=php_openssl.dll is no longer commented out. I even confirmed that the .dll is in the ext folder of the PHP folder. Both libeay32.dll and ssleay32.dll are in the PHP and Apache folders. The Apache folder doesn't contain either productive or development php.ini files.

我去了 http://www.slproweb.com/products/Win32OpenSSL.html 和安装 Win32 OpenSSL v1.0.0d 以确保安全.

I've went to http://www.slproweb.com/products/Win32OpenSSL.html and installed Win32 OpenSSL v1.0.0d for safe measure.

现在我的retrieve_website.php中有问题的代码行如下所示:

Now the line of code in question in my retrieve_website.php looks like this:

$urlquery = "https://www.googleapis.com/customsearch/v1?key=".$appid."&cx=".$google_searchid."&q=".$query."&alt=atom&num=".$results;
$xmlresults = file_get_contents($urlquery);

我还有另外两个网站可供查询,但它们是通过 HTTP 提供的,并且运行良好.我还在脚本末尾附近输入了这行代码:

I have two other websites that I query but they are served via HTTP and they work fine. I also have this line of code entered near the end of the script:

echo 'openssl: ',  extension_loaded  ('openssl') ? 'yes':'no', "\n";
echo 'http wrapper: ', in_array('http', $w) ? 'yes':'no', "\n";
echo 'https wrapper: ', in_array('https', $w) ? 'yes':'no', "\n";
echo 'wrappers: ', var_dump($w);

当我在 Eclipse 上将它作为 PHP 脚本运行时,一切都以我想要的方式完美地输出,并附有这些结果:

When I run it as a PHP Script on Eclipse, everything outputs perfectly fine the way I want along with these results:

openssl: yes
http wrapper: yes
https wrapper: yes
wrappers: array(10) {
  [0]=>
  string(5) "https"
  [1]=>
  string(4) "ftps"
  [2]=>
  string(3) "php"
  [3]=>
  string(4) "file"
  [4]=>
  string(4) "data"
  [5]=>
  string(4) "http"
  [6]=>
  string(3) "ftp"
  [7]=>
  string(13) "compress.zlib"
  [8]=>
  string(14) "compress.bzip2"
  [9]=>
  string(3) "zip"
}

尽管我进行了所有这些更改(在我启动 Apache 之后),当我第一次通过 http://localhost/tutorial/retrieve_website.php:

Despite all these changes I've made (after I started up Apache), I still get the same errors the first time I access my PHP script in Eclipse and Firefox via http://localhost/tutorial/retrieve_website.php:

警告:file_get_contents() [function.file-get-contents]:无法找到包装器https"——您是否在配置 PHP 时忘记启用它?在 C:\xampp\htdocs\tutorial\retrieve_website.php 中的第 29 行

警告:file_get_contents(https://www.googleapis.com/customsearch/v1?key=已删除的 API ID&cx=已删除的搜索 ID&q=The+Devil+went+down+to+Georgia&alt=atom&num=5) [function.file-get-contents]:无法打开流:C:\xampp\htdocs\tutorial\retrieve_website 中没有这样的文件或目录.第 29 行的 php

警告:DOMDocument::loadXML() [domdocument.loadxml]:在第 33 行的 C:\xampp\htdocs\tutorial\retrieve_website.php 中作为输入提供空字符串

openssl:没有 http 包装器:是 https 包装器:没有包装器:array(10) { [0]=> string(3) "php" [1]=> string(4) "file" [2]=> string(4)) "glob" [3]=> string(4) "data" [4]=> string(4) "http" [5]=> string(3) "ftp" [6]=> string(3) "zip" [7]=> string(13) "compress.zlib" [8]=> string(14) "compress.bzip2" [9]=> string(4) "phar" }

Warning: file_get_contents() [function.file-get-contents]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in C:\xampp\htdocs\tutorial\retrieve_website.php on line 29

Warning: file_get_contents(https:// www.googleapis.com/customsearch/v1?key=removed API ID&cx=removed search ID&q=The+Devil+went+down+to+Georgia&alt=atom&num=5) [function.file-get-contents]: failed to open stream: No such file or directory in C:\xampp\htdocs\tutorial\retrieve_website.php on line 29

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Empty string supplied as input in C:\xampp\htdocs\tutorial\retrieve_website.php on line 33

openssl: no http wrapper: yes https wrapper: no wrappers: array(10) { [0]=> string(3) "php" [1]=> string(4) "file" [2]=> string(4) "glob" [3]=> string(4) "data" [4]=> string(4) "http" [5]=> string(3) "ftp" [6]=> string(3) "zip" [7]=> string(13) "compress.zlib" [8]=> string(14) "compress.bzip2" [9]=> string(4) "phar" }

我忽略或没有做的事情是什么?据我所知,我已经完成了有关 HTTPS 和 OpenSSL 的所有研究

What is it that I have overlooked or failed to do? To my own knowledge, I've done everything that I've researched about concerning HTTPS and OpenSSL

推荐答案

我在 XAMPP 中通过在 /apache/bin/php.ini<中取消注释 ;extension=php_openssl.dll 解决了这个问题/code> 尽管 phpinfo() 告诉我 /php/php.ini 是加载的 ini 文件.

I solved it in XAMPP by uncommenting ;extension=php_openssl.dll in /apache/bin/php.ini despite phpinfo() telling me /php/php.ini was the loaded ini file.

我想 Ezra 的答案是直接将扩展行添加到适当的 ini 文件的最佳解决方案.

I guess Ezra answer is the best solution directly adding the extension line to the appropriate ini file.

这篇关于无法找到包装器“https"- 您是否在配置 PHP 时忘记启用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆