Posted by & filed under PHP, Web Server.

After our recent transition to MediaTemple, we realized that our homepage wasn’t being updated with our latest Twitter posts. As it turns out, the server has the ability to access remote files disabled by default, which is a good thing to prevent Remote File Injection attacks, but a bad thing if you want your Twitter account to update your homepage ;).

So, to fix this, you’ll need to re-enable it in your php.ini file. If you’re using the (gs) plan, you’ll want to FTP into your domain, go to the root folder, go into the etc folder, and add a file named php.ini with the following contents:

allow_url_fopen = On

This will let file_get_contents() and fopen() have the ability to accept URL’s as an argument.

Thomas Hunter II

Thomas is the author of Advanced Microservices and a prolific public speaker with a passion for reducing complex problems into simple language and diagrams. His career includes working at Fortune 50's in the Midwest, co-founding a successful startup, and everything in between.
(Visited 5,932 times, 147 visits today)


  • Thank you for sharing this with the community!

    Scott DeSmet
    (mt) Media Temple

  • thanks! worked perfectly on a client site hosted with MT.

  • Michael Pelz-Sheman

    This isn’t working for me for a PHP script run as a cron job. I also tried setting the option in my script using ini_set, to no avail. Still getting “Warning: fopen(): URL file-access is disabled in the server configuration” when I run the script. Any suggestions?

    • MT might have a separate php.ini for CLI vs httpd executed PHP (I’ve seen some distro’s do this).

      So, you might want to try having your CRON execute your script by doing a “wget http://URL“, instead of a “php /path/to/file”.

      Otherwise, you could always edit the script and switch to using cURL instead of fopen.

  • how to fix
    failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version Not Supported