問題在於這個問題。我已經對這方面的解決方案進行了徹底的調查,我知道這有些話題,我也跟着他們,沒有任何工作。話雖如此,我將列出我到目前爲止所做的一切。我使用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