×

How to enable allow_url_fopen on a cPanel hosting account?

The allow_url_fopen directive in PHP allows functions like fopen(), file_get_contents(), and include() to access remote files using HTTP or FTP protocols. This setting is often required for applications that fetch external data, such as RSS feeds or APIs.

If your hosting account uses cPanel, enabling allow_url_fopen can usually be done without root access, provided the server allows local PHP configuration overrides.

  1. Log in to your cPanel account.
  2. In the Software section, click on MultiPHP INI Editor.
    cPanel MultiPHP INI Editor Button
  3. Select the domain or subdomain where you want to modify the PHP settings.
    MultiPHP INI Editor Select Location
  4. Scroll down to find the directive allow_url_fopen and switch it to On.
  5. Save the changes by clicking on the Apply button.


Note: If the directive is greyed out, locked or not shown, it means your hosting provider does not allow this setting to be changed from cPanel. In that case, contact your hosting provider for assistance.

Enabling allow_url_fopen can introduce security risks if not handled properly. Ensure your scripts sanitize and validate any external URLs.

If you cannot change this setting yourself, your hosting provider may restrict it for security reasons. In such cases, submit a support ticket to request assistance.