问题在于这个问题。我已经对这方面的解决方案进行了彻底的调查,我知道这有些话题,我也跟着他们,没有任何工作。话虽如此,我将列出我到目前为止所做的一切。我使用Zend Debugging在我的Windows XP计算机上的最新Eclipse版本上运行PHP 5.2.14。我有1 GB的RAM。我有安装Apache,MySQL和FileZilla的XAMPP。 从XAMPP控制面板中点击了管理就去https:// localhost/xampp/
:无法找到包装器“https” - 您配置PHP时是否忘记启用它?
在XAMPP下面我做(Apache的这些变化过程中关闭)。从那里,我接受了欢迎页面上来自该行的证书:
For OpenSSL support please use the test certificate with https:// 127.0.0.1 or https:// localhost.
在同一节中,我检查phpinfo()
。在'环境'下,SERVER["HTTPS"]
是on
。在“Apache环境”下,HTTPS
是On
。 'PHP变量下,_SERVER["HTTPS"]
是On
。在'Phar'下,OpenSSL support
是disabled
(安装ext/openssl)。我不知道如何启用Phar。
现在关于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并安装了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);
当我运行它作为一个PHP脚本在Eclipse上,一切都输出完全没有我与这些结果一起想要的方式:
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脚本:
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的所有内容。
跑了卷曲功能,你给我和更换'$ xmlresults =的file_get_contents($ urlquery);'和'$ xmlresults =卷曲($ urlquery);'。 PHP脚本运行得很好,其结果与file_get_contents()相同。通过http://localhost/tutorial/retrieve_website.php将其作为PHP Web页面运行,并且出现此错误:致命错误:调用C:\ xampp \ htdocs \ tutorial \ retrieve_website.php中的未定义函数curl_init() 14' – 2011-03-26 20:04:53
问题是在SSL支持probaby,运行** phpinfo()**并检查是否有以下命令/标志:''--with-openssl =/usr''--with-openssl-dir =/usr '',基本上你需要使用SSL支持来编译Apache,你也应该启用比FGC快几倍的cURL,并且有很多选项。我不知道如何在Windows上执行此操作,很抱歉。 – 2011-03-26 20:13:58
唯一接近的就是在phpinfo()的顶部配置命令,并且没有包含--with-openssl相关的任何东西。它包含其他 - 与事物。小更新:在本地主机上,检查状态,它说HTTPS(SSL)已激活。 – 2011-03-26 21:52:24