问题在于问题本身。我已经做了一个彻底的调查,以解决这方面的问题,我知道有这方面的主题,我已经按照他们了,没有一个工作。话虽如此,我还是要列出目前为止我所做的一切。在我的 Windows XP 电脑上,我正在使用 Zend Debugging 版本的最新 Eclipse 运行 PHP 5.2.14。我有1GB 的内存。我在安装了 Apache、 MySQL 和 FileZilla 的情况下运行了 XAMPP。
在 XAMPP 上,我做了以下工作(Apache 在这些更改期间关闭) :
从 XAMPP 控制面板上点击 管理员,转到 https:// localhost/xampp/
。从那以后,我接受了欢迎页面上这一行的证书:
对于 OpenSSL 支持,请使用 https://127.0.0.1或 https://localhost 的测试证书。
在同一个部分,我检查 phpinfo()
。在「环境」一栏中,SERVER["HTTPS"]
是 on
。在“ Apache 环境”下,HTTPS
是 On
。在“ PHP 变量”下,_SERVER["HTTPS"]
是 On
。在‘ Phar’下,OpenSSL support
是 disabled
(install ext/openssl)。我不知道如何启用 Phar one。
现在关于 C: xampp 中的文件本身,我转到 PHP 文件夹。在生产和开发 php.ini 文件下(安全比遗憾好) ,我有 allow_url_fopen=On
、 allow_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并安装了 Win32OpenSSLv1.0.0 d。
现在,我的 return _ 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 之后) ,但是当我第一次通过 http://localhost/tutorial/retrieve_website.php访问 Eclipse 和 Firefox 中的 PHP 脚本时,仍然会得到相同的错误:
警告: file _ get _ content ()[ function. file-get-content ] : 无法找到包装器“ https”-在配置 PHP 时是否忘记启用它?在 C 语言中: xampp htdocs 教程在第29行检索 _ website.php
警告: file _ get _ content (https:// www.googleapis.com/customsearch/v1?key=abc0&cx=abc1&q=the+devil+went+down+to+georgia&alt=atom&num=5)[ function. file-get-content ] : 未能打开流: 在 C: xampp htdocs 中没有这样的文件或目录 警告: DOMDocument: : loadXML ()[ DOMDocument.loadXML ] : 在 C: xampp htdocs 教程中作为输入提供的空字符串在第33行 < br/> < br/> < br/> 检索 _ website.php Openssl: no http wrapper: yes https wrapper: no wrappers: array (10){[0] = > string (3)“ php”[1] = > string (4)“ file”[2] = > string (4)“ globb”[3] = > string (4)“ data”[4] = > string (4)“ http”[5] = > string (3)“ ftp”[6] = > string (3)“ zip”[7] = > string (13)“ press。“ zlib”[8] = > string (14)“ compress。Bzip2”[9] = > string (4)“ phar”}
我忽略了或者没有做到的是什么?据我所知,我已经做了所有关于 HTTPS 和 OpenSSL 的研究