Skip to content
Help Center

How to enable and disable allow_url_fopen in PHP

Learn how to enable or disable the allow_url_fopen option in your PHP installation.

This article describes how to enable the allow_url_fopen directive in your own php.ini file.

Important

This article assumes you already have your own php.ini file installed on your hosting service. If you have not yet installed this file, first check the article: How do I install my own php.ini file?

allow_url_fopen disabled by default

By default, this feature is disabled because it poses a security risk. Any webmaster who enables it should be aware of the security implications.

How to enable it?

When allow_url_fopen is active, you can write programs that open remotely located files, in the same way you would open them locally. To enable this option, add the following to your php.ini file: allow_url_fopen = on. If you want to disable the feature, write in php.ini: allow_url_fopen = off