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

allow_url_fopen

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
allow_url_include

this time.

{openx:6}

So either set in php.ini

allow_url_fopen = On
allow_url_include = On

or use this in your PHP code:

<?php
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.