Calling file_get_contents() with https:// urls give me the following error:
warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?
I've read 10+ SO questions and all of them say to enable extension=php_openssl.dll
I did this and I'm still having issues...
What else could it be?
SOLVED
To solve this error, you need to install the OpenSSL
package for PHP on your webserver.
On a FreeBSD server, you may need to install the following package: php53_openssl
and restart your webserver.
On a Windows server, open your php.ini
config file and simply uncomment the following line:
;extension=php_openssl
and restart the webserver. The error should be resolved.
Reference: I leart it from this link which worked for me.., so credit goes to him.
On newer versions of PHP on Windows, the accepted answer won't work.
For PHP 7.x, you need to uncomment (remove the ;
at the beginning of the line) the following lines:
extension_dir = "ext"
extension=openssl
For PHP 7 on Windows 64bit be sure to put libcrypto-1_1-x64.dll
to the environmental variable path. For example: C:\php\libcrypto-1_1-x64.dll;
I just wanted to add this tidbit because I struggled for hours with this issue and finally figured out something that works. With a lot of these WAMP/XAMP/MAMP installations, the configuration files are placed in non-standard directories (i.e., C:\MAMP\conf\php\php7.2.10\php.ini). You need to make sure that your php cli has loaded the INI you are modifying.
$ php --ini
If it is not pointing to the correct INI, or loads no configuration file at all, you can change the PHPRC environment variable for the user executing the script to point to the correct location for the INI that you have correctly modified. Also, ensure that the extension_dir parameter in php.ini is contains the correct path to where your extensions are stored.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With