PHP Selector: How to adjust php values and where they are stored

269ac00f765508cb74b25d006dbf5bb2

Written by Dennis Nind

Last published at: April 11th, 2019

Do you have questions about how php-selector works or how to customize php for your needs? We will try to answer them in next few posts. 

PHP Selector is a CloudLinux component that sits on top of CageFS and allows each user to select PHP version & modules based on the customer's needs 

Global PHP defaults for PHP Selector - php version and enabled modules are configured in /etc/cl.selector/defaults.cfg

Default values are one applied for all users and are active as long as they are not changed by use. They are set in /opt/alt/phpXX/etc/php.ini file, where XX is the php version. For example, default php.ini for php 5.3 will be /opt/alt/php53/etc/php.ini . The settings from that file will not be overwritten with the next update, so that is the place where you should set your customized values like timezone or disable_functions, etc... 

Users can change php values using control panel interface. By doing that, new /etc/cl.php.d/alt-php52/alt_php.ini file will be generated (path accessible only from inside of CageFS and will have different file for each user). Settings in that file will overwrite settings from php.ini . The exhaustive list of directives and values that customers are allowed to change are set in /etc/cl.selector/php.conf file. 

The command cagefsctl --rebuild-alt-php-ini rebuilds customers alt_php.ini files, based on custom values from /home/USER/.cl.selector/alt_phpXX.cfg

Checking current PHP version for any specific customer could be done with /usr/bin/cl-selector --current=php --user=USERNAME command. 

Administrator may force update of any individual php.ini settings using /usr/bin/piniset tool. 

Example command to change upload maximum filesize value would be: 

/usr/bin/piniset -r 'upload_max_filesize:16M' -u USERNAME 

You may find more information in our documentation at http://docs.cloudlinux.com/index.html?php_selector.html