URL file access is disabled in server configuration

Once in a while you’ll see the error message “URL file access is disabled in server configuration” when opening an external URL using PHP. In general, this means that the HP setting


is set to false. Today I ran into this problem but

allow_url_fopen was set to <em>true</em>. As it turned out the culprit was

this time.


So either set in php.ini

allow_url_fopen = On
allow_url_include = On

or use this in your PHP code:

ini_set('allow_url_fopen', 'on');
ini_set('allow_url_include', 'on');

I should probably add that both settings default to ‘Off’ for a reason. Both are the major entry gates for malicious code when used without proper care.