How to enable allow_url_fopen for a single site in cPanel

 
It is recommended to set always off allow_url_fopen at a global level.

But allow_url_fopen is considered a global PHP configuration value, and thus enabling it on a per-domain basis isn't allowed when it's disabled in the global PHP configuration file.

allow_url_fopen is a value labeled system, and cannot be altered in a local ini file. Since the options set in the MultiPHP Manager through cPanel are local changes, this will not work.

(For a full list of values and their types, see http://php.net/manual/en/ini.list.php  )
 

So, what if a single site need allow_url_fopen enabled ?

Any labeled PHP_INI_SYSTEM cannot be changed by local ini files. The exception to this is that when using the SuPHP handler you can overwrite the "system" ini location to the local files using suPHP_ConfigPath in the .htaccess file.
This can be done by specifying the new system php.ini in the users .htaccess file with a line like the following.


suPHP_ConfigPath /home/$user/php.ini

In order to enable this it's recommended that you set it in WHM for the System INI(Home »Software »MultiPHP Manager).
Since you do not want this change done system-wide, you do have the option of using a custom configuration using a local php.ini after changing the users PHP handler to SuPHP.
This requires a fully formed php.ini and would allow the user access to changing all variables in it.


The best method to start this configuration, would be to copy the php.ini to the local home directory.


cp /opt/cpanel/ea-php56/root/etc/php.ini /home/user/


If you place the php.ini in the public_html, it's recommended securing the file from being accessible with a standard deny entry. 

For example:

<Files php.ini>
order allow,deny
deny from all
</Files>
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Launch your website to cpanel

Having completed creating your website locally your need to host the website. Requirements...


Add and Configure an FTP Account in cPanel

  FTP accounts enable you to upload and manage files on your website. This article...


Block an IP address or a Domain Name Using cPanel

Blocking an IP address or domain name can improve website security as it helps prevent hacking...


Change File Permissions in cPanel

An overview of file permissions There are three levels of file permission, these are read,...


Change IP addresses for multiple accounts

If you add a new IP address to a server or change the shared IP address of your server, you may...