gpt4 book ai didi

php - 找不到包装器 "https"- 您在配置 PHP 时是否忘记启用它?

转载 作者:IT老高 更新时间:2023-10-28 11:45:00 26 4
gpt4 key购买 nike

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

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

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。

现在关于 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 文件。

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

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

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

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

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 脚本运行时,一切都按照我想要的方式完美输出以及这些结果:

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 之后),当我第一次在 Eclipse 和 Firefox 中通过 http://localhost/tutorial/retrieve_website.php 访问我的 PHP 脚本时,我仍然遇到同样的错误。 :

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 的所有研究

最佳答案

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

编辑:我猜 Ezra 的答案是直接将扩展行添加到适当的 ini 文件中的最佳解决方案。

关于php - 找不到包装器 "https"- 您在配置 PHP 时是否忘记启用它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5444249/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com