How to Set Custom php.ini Values in Cagefs for PHP Selector

CloudLinux's Cagefs allows each user to have their own custom php.ini settings with the php selector. However the options presented inside have pre-defined limits that may not work for all users.

It is possible to modify custom settings by hand through the command line.

Start by going into the command line. After you're in, run the following command to get into the specific user's caged environment:

cagefsctl -e <username>

This will take you to a new prompt. Once there, you can use a text editor to modify the php settings directly:

Make sure to edit the correct file for the version of PHP you have selected otherwise the changes will not go into effect. Replace the XX with your version of PHP, so for version 5.4 the path would be /opt/alt/php54/link/conf/alt_php.ini

nano /opt/alt/phpXX/link/conf/alt_php.ini

Once there, you will see a section like this:

;>=== Start of PHP Selector Custom Options ===
;<=== End of PHP Selector Custom Options =====

Inside of this section, you can put in your custom PHP Variables such as memory_limit, post_max_size or any other thing you may need to change. You should put them just as if you were modifying any php.ini file, but keep them in that section to make it easy to find later if you need to change it again.

If you've already modified your PHP options within the PHP selector, you will see some custom values in that section.