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.
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:
For OpenSSL support please use the test certificate with https:// 127.0.0.1 or https:// localhost.
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.
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.
I've went to http://www.slproweb.com/products/Win32OpenSSL.html and installed Win32 OpenSSL v1.0.0d for safe measure.
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);
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);
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"
}
Despite all these changes I've made (after I started up Apache), I still get the same errors the first time I access my PHP script in Eclipse and Firefox via http://localhost/tutorial/retrieve_website.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" }
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
/apache/bin/php.ini
, I cannot find it in XAMPP Portable Light 1.8.1? Howeverphp/php.ini
exists, but enabling ssl here does not help :( – Bravery