August 9, 2010

Fixing “Warning: file_get_contents()” php error

Filed under: PHP Hints and Tricks — Paul Vint @ 7:31 pm

I recently got the following error on a newly installed webserver:

Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /var/www/localhost/htdocs/wordpress/wp-content/plugins/statsurfer/statsurfer.php on line 3543
This happened to me after activating StatsSurfer for this blog, and that big ugly error would appear at the top of every page.

Thankfully, the fix is quite easy (strangely hard to google for though), in your php.ini file (mine’s at /etc/php/apache2-php5/php.ini – other *nix variants will be similar), just change the following line in the php.ini file from:

allow_url_fopen = Off

To:

allow_url_fopen = On

I recently got the following error on a newly installed webserver:

Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /var/www/localhost/htdocs/wordpress/wp-content/plugins/statsurfer/statsurfer.php on line 3543
This happened to me after activating StatsSurfer for this blog, and that big ugly error would appear at the top of every page.

Thankfully, the fix is quite easy (strangely hard to google for though), in your php.ini file (mine’s at /etc/php/apache2-php5/php.ini – other *nix variants will be similar), just change the following line in the php.ini file from:

allow_url_fopen = Off

To:

allow_url_fopen = On

Restart Apache, and off you go.

2 people like this post.

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

*

Powered by WordPress