Quick Fix for URL file-access is disabled Issues

07 Apr 2010
April 7, 2010

While working with a 1and1.com hosted WordPress blog I hit a PHP error:

URL file-access is disabled in the server configuration

This error arises when allow_url_fopen is set to “OFF” in the server’s php.ini file – which is the default value for (I believe) PHP 5. That setting controls your script’s access to the include and require statements and access to remote files. As such, there are certainly security concerns, so don’t follow my suggestion below until you understand if you really need it, why you need it, and that your script is safe and sanitizing data.

Just like my last Quick Tip for 1and1.com this is another quick fix, just a little different. If you manage your own server, just locate and edit the php.ini file. However, for folks using shared hosting (I suspect the majority) that’s not going to be an option.

However, you may be able to create your own “local” php.ini file. Add the following line:

allow_url_fopen = ON

Save the php.ini and upload it to the main directory of your site and test. For my 1and1 hosted app this worked instantly and solved my issues.

I’ve seen similar solutions that involve adding the following to the .htaccess file:

php_flag allow_url_fopen on

With 1and1, though, this only generates HTTP 500 errors and a busted app. However, it is definitely worth a shot on other hosting company servers.

Tags: , , , ,
19 replies
  1. Darren says:

    Thank you!
    Saved me a ton of time, php.ini worked… just uploaded to my working directory of 1and1.

    thanks again

    -d

    Reply
  2. annie says:

    woo!!
    seriously, ive visited a ton of sites trying to figure this out and you said it perfectly:)

    tytyty!

    Reply
  3. Vladimir says:

    php_flag does not work for 1and1 because PHP runs as a FastCGI server, not as an Apache module; as a consequence, no PHP configuration directives are available in .htaccess.

    Reply
  4. mike! says:

    Worked perfectly, thanks! It’s hellah discouraging how many workarounds are needed to manage a WP on 1and1. I’m thinking the ultimate work around is to migrate off them all together.

    Oof!

    Reply
  5. Gilberto J Perera says:

    Just ran into this issue with 1&1 hosting and I was able to resolve it with the php.ini file and the allow_url_fopen = ON

    Thanks for saving me the time and the headaches!

    Reply
  6. Scott Donnelly says:

    Hi! Same issue, same solution. Thanks for the tip, this could come in handy in other ways now I know the php.ini thing is possible!

    Reply
  7. Ivan says:

    I tried that and i get it activated. However, i still receive the same error in the script. what should i do?

    Thanks.

    Reply
  8. Giga says:

    i dont know who you are but….

    i love you

    Reply
  9. gerry says:

    Whre do i put the code though? is this righ tbelow?

    Untitled Document
    allow_url_fopen = ON

    Reply
  10. Ice Man says:

    If you are running Joomla on 1and1 shared hosting, put the php.ini file in the Administrator folder for it to work with the updater.

    Reply
  11. Biscuit says:

    the php.ini worked perfectly for a WordPress install on 1 and 1… thank you!

    Reply
  12. Morton says:

    Worked for me.

    Only trick was I had to put it in exactly the directory where I used it.

    It didn’t work when I put it in the root directory for the site, but rather had to put php.ini in the directory that serves files for the path where I used it.

    i.e. it work in the directory that serves http://~domain.com files, but rather had to place it in the directory for path where I was using the script e.g. ~domain/path

    Reply
  13. Bekah says:

    1and1 has a tool in the admin panel to help you do this. Under Web Space, click ‘local PHP settings’, name it whatever you want, and select the file where you want the php.ini doc created, then click your settings. I also found that the php.ini had to be in the directory of the specific plugins that needed them, so if it doesn’t work the first time, keep trying.

    Reply
  14. Joel says:

    For 1and!1, I created the php.ini and it fixed all of the problems that I had for a month. When I upgraded to Evolution 1.06, I lost my RSS ticker feed. On my development USB, it was working. It drove me crazy. I didn’t realize that this was an external URL restriction. ( I may have upgraded PHP to 5, but don’t recall). Great Fix.

    Reply
  15. Rotimi says:

    Thanks it worked for me on 1and1! THANK YOU!

    Reply
  16. Isaac says:

    Thanks a lot! I searched and searched until I was able to find the proper term as to what my problem was. Hopefully this post will get indexed better by Google.

    Reply
  17. Pierre says:

    Thanks! Fixed my issue…

    Reply

Trackbacks & Pingbacks

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>