URL file-access is disabled in the server configuration

When opening external URL's through PHP, you might stumble upon the dreaded "URL file-access is disabled in the server configuration"-error message.

It just means that remote access was disabled in the server configuration, so you can't load external files (say: images, text files, xml files, ...). If the server allows you to override the server configuration in PHP scripts, you can do the following on top of the page you're experiencing this problem.

<?php
ini_set('allow_url_fopen', 'on');
// .....
?>

If that's not allowed, you can change this setting in the php.ini file, maintained by your server administrator.

/*;;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
;;;;;;;;;;;;;;;;;;
 
; Whether to allow the treatment of URLs (like http:// or ftp://) as files. */
allow_url_fopen = On

In most cases however, this won't be allowed. You could try functions such as file_get_contents(), and parse the result afterwards - to have a similar working method such as fopen().

Spread the word
If you liked the content of this article, please vote for it on the following websites - thanks.
  • Facebook
  • Twitter
  • del.icio.us
  • LinkedIn
  • DZone
  • Reddit
  • Digg
  • StumbleUpon
  • Sphinn
This entry was posted in php and tagged , , , , . Bookmark the permalink.

3 Responses to URL file-access is disabled in the server configuration

  1. Binny V A says:

    Or you can use curl functions or fsockopen function.

    If you want an easier solution use my load() function.

  2. Piyuush says:

    URL file-access is disabled in the server configuration ,solve this error ,give me suggestion

  3. Pingback: Gentoo Linux ebuild for SilverStripe 2.2.3

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> <pre lang="" line="" escaped="">