Warning: File_Get_Contents

An error such as this one:

Warning: file_get_contents (http://www.url.com/url) [function:file-get-contents]: failed to open stream on line xyz

Most of the time, such errors occur because your web host has strict security settings in the PHP configuration (“security” not as in to prevent hacks, but to prevent overuse of server resources, etc.).

If you have access to php.ini file, you can resolve the error yourself. Open the file, and locate the following line:

allow_url_fopen = Off

Now change the “off” value to “on”, as follows:

allow_url_fopen = On

If you do not have access to your php.ini file, you will need to contact Basehost and ask them to enable allow_url_fopen. Also, if this error is followed by a message such as “failed to open stream: no such file or directory in…”, it can mean that the mentioned file is either missing or not readable (look for it in the specified path, and if you find it, check its file permissions).

Was this article helpful?
0 out of 0 found this helpful