Fix: file_get_contents() wrapper is disabled error in PHP

Today, We want to share with you Fix: file_get_contents() wrapper is disabled error in PHP.In this post we will show you enable stream wrappers in the php ini file, hear for allow_url_fopen is disabled. file_get_contents would not work we will give you demo and example for implement.In this post, we will learn about wrapper is disabled in the server configuration by allow_url_fopen=0 cpanel with an example.

Fix: file_get_contents() wrapper is disabled error in PHP

There are the Following The simple About Fix: file_get_contents() wrapper is disabled error in PHP Full Information With Example and source code.

As I will cover this Post with live Working example to develop how to set allow_url_fopen in php, so the some major files and Directory structures for this example is following below.

Read Also:  how to trigger a file download in javascript?

“file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0”

Fix This Error

"file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0

Select the main domain name in cpanel home directory or a domain’s document root to open the corresponding PHP settings with configuration.

PHP Directive : allow_url_fopen

This option enables the URL-aware fopen wrappers that enable accessing URL object like files. Default wrappers are provided for the access of remote files using the ftp or http protocol, some extensions like zlib may register additional wrappers.

Configure PHP INI basic settings

Step 1:

First of all, We can check your PHP file with this source code and then enable the fopen in your php.ini file

Read Also:  Angular 6 Event Binding Tutorial From Scratch

<?php
if( ini_get('allow_url_fopen') ) {
die('Good Luck !! v allow_url_fopen is enabled. file_get_contents should work well');
} else {
die('Sorry Your allow_url_fopen is disabled. file_get_contents would not work');
}

?>

Step 2:

and then simple we can Edit the php.ini file and enable using below source code
(Enable the allow_url_fopen parameter in your php.ini configuration)

allow_url_fopen = 1 // SET 0 for Off and 1 for On Flag
allow_url_include = 1 //SET 0 for Off and 1 for On Flag

Server configuration by allow_url_fopen=0 in

ini_set('allow_url_fopen',1);

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Fix: file_get_contents() wrapper is disabled error in PHP.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.