Enable allow_url_fopen for a single domain in a cPanel server

The method to be followed to enable allow_url_fopen on a phpsuexec and a non-phpsuexec server is different. For security reasons the option is mostly disabled server wide, however, you can enable for a single domain/account if it is required.

On a non phpsuexec server:

# cd /usr/local/apache/conf/

see if you have a “userdata” directory there? If not, create the “userdata/” directory and then the file allowurl.conf inside it. So the complete path should look like:

# vi /usr/local/apache/conf/userdata//allowurl.conf

and add the following to the file

php_admin_value allow_url_fopen On

php_admin_value allow_url_include On
Now, edit the Apache configuration file and scroll down to the VirtualHost entry of the domain. Include the path of the

Now, edit the Apache configuration file and scroll down to the VirtualHost entry of the domain. Include the path of the above created file in it, as shown below:

Include “/usr/local/apache/conf/userdata//allowurl.conf”

Save the file and rebuild the apache configuration by

# /usr/local/cpanel/bin/apache_conf_distiller –update

# /usr/local/cpanel/bin/build_apache_conf

# /scripts/restartsrv httpd

This will enable allow_url_fopen for that domain.

On a PHPSuExec Or SuPHP server:
On a SuPHP enabled server, turning ON allow_url_fopen in the VirtualHost entry won’t work since PHP is not working as an Apache Handler anymore.

In such a case, copy the global php.ini of the server under directory of the domain, say public_html (you need to copy php.ini to the directory, where your script with allow_url_fopen resides)

# cp /usr/local/lib/php.ini /home//public_html/

Edit the new php.ini file and enable allow_url_fopen in it

allow_url_fopen = On

Save the file. That’s it.

please replace “” with the actual username of the domain wherever stated above.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.