Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to find the wrapper "https" with file_get_contents

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?

like image 346
John Smith Avatar asked Sep 05 '13 18:09

John Smith


4 Answers

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.

like image 90
Amit Shah Avatar answered Oct 22 '22 08:10

Amit Shah


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

like image 26
Vitox Avatar answered Oct 22 '22 08:10

Vitox


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;

like image 3
Артем Avatar answered Oct 22 '22 08:10

Артем


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.

like image 3
Jack Avatar answered Oct 22 '22 06:10

Jack