无法找到包装" HTTPS" - 你忘了启用它,当你配置PHP?

问题描述:

问题是在问题。我已经做了在关于这个解决方案的深入调查,我知道有主题这一点,我已经跟着他们也并没有奏效。话虽这么说,我会列出一切正是我目前做的。我在我的Windows XP计算机上安装最新版本的Eclipse运行PHP 5.2.14与Zend调试。我有一个1 GB的RAM。我有XAMPP与Apache,MySQL的运行,并安装FileZilla中。

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控制面板中点击的管理的就去 https://开头本地主机/ 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://本地主机

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

在同一节中,我检查的phpinfo()。在环境, SERVER [HTTPS] 。在阿帕奇环境, HTTPS 。在PHP变量, _ SERVER [HTTPS] 。根据的Phar', OpenSSL的支持禁用(安装分机/ OpenSSL的)。我不知道如何启用的Phar之一。

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选项在 allow_url_include =开,我删除了分号,使扩展= p​​hp_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.

现在的code的问题,在我的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服务,他们工作得很好。我也有这个线附近脚本的末尾输入code的:

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);

当我运行它作为一个PHP脚本在Eclipse上,一切都输出完全正常我与这些结果一起想要的方式:

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:

警告:file_get_contents()函数[function.file-GET-内容]:无法找到包装https开头 - 你忘记启用它,当你配置PHP?在C:\\ XAMPP \\ htdocs中\\在线教程\\ retrieve_website.php 29


  警告:的file_get_contents(https://开头www.googleapis.com/customsearch/v1?key=removed API ID 的&安培; CX =的删除搜索ID 的&安培; Q = +的魔鬼+去+下+至+格鲁吉亚和放大器; ALT =原子试验#= 5)function.file-GET-内容]:未能打开流:C中没有这样的文件或目录:\\ XAMPP \\ htdocs中\\教程\\ retrieve_website。在线PHP 29


  警告:DOM文档:: loadXML的()[domdocument.loadxml]:作为输入c供给空字符串:\\ XAMPP \\ htdocs中\\在线教程\\ retrieve_website.php 33


  OpenSSL:已没有HTTP包装:是HTTPS包装:无包装:阵列(10){[0] =>串(3)PHP[1] =>串(4)文件[2] =>串(4 )水珠[3] =>串(4)数据[4] =>串(4)HTTP[5] =>串(3)FTP[6] =>串(3)拉链[7] =>串(13)COM press.zlib[8] =>串(14)COM press.bzip2[9] =>串(4)药业 }

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通过取消注释;在延长= php_openssl.dll /apache/bin/php.ini 尽管的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.

编辑:我想答案以斯拉是最好的解决直接添加延长线到相应的ini文件

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