Enable or Disable PHP Functions For One cPanel Account

Enabling certain PHP functions for all users can be a security risk. However, by creating a user specific php.ini file, the risk can be mitigated for that one (hopefully trusted) user who needs a bit more functionality.

Step 1: Find the main copy of the php.ini file – probably located as /usr/lib/php.ini

Step 2: Copy it to the root directory of your user.
cp /usr/lib/php.ini /home//public_html/

Step 3: Edit the new php.ini file and edit the ‘disable_functions’ line to include or remove whichever function you want.

Step 4: Create or edit the .htaccess file in the sites root directory and insert the following:
<IfModule mod_suphp.c>
suPHP_ConfigPath /home/<cPanel user>/public_html/php.ini
</IfModule>
<Files php.ini>
order allow,deny
deny from all
</Files>

Voila

Leave a Reply

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