How to install a PHP version picker on ClearOS

ClearOS by default ships with an old version (5.4) of PHP. This app permits to use PHP 5.6, 7.0 and 7.1 from Software Collections (and later 7.2 for developers from Remi's RPM repository) by taking advantage of PHP's FastCGI Process Manager (FPM)

Status as of 2019-04-24: Added PHP 7.2 support: http://koji.clearos.com/koji/packageinfo?packageID=332

Status as of 2018-02-10: Now with PHP 7.1 and improvements to Command Line handling

Status as of 2017-11-24: The app is complete. Next step is to ask ClearOS community to test extensively.

Login to your ClearOS via SSH (as root)
yum install app-php-engines

And you will get:
ClearOS PHP Version Picker


  • Permits to pick PHP version for various websites, including in the command line version.

How to override settings

We plan add a way to override settings via the GUI but for now, you need to edit some configuration files.


Create a .user.ini and put where in the directory where your Tiki is

memory_limit = 256M 
upload_max_filesize = 64M 
zlib.output_compression = 1

And if you want errors displayed, also add this
display_errors = On



For some php.ini variables (ex.: post_max_size), you cannot override these settings in .user.ini, so these must be set in the PHP Engine's php.ini files

  • /etc/opt/rh/rh-php56/php.ini
  • /etc/opt/rh/rh-php70/php.ini
  • /etc/opt/rh/rh-php71/php.ini

If the values don't pick up, just reboot your server.


Settings change be changed here:

  • /etc/opt/rh/rh-php56/php.d/10-opcache.ini
  • /etc/opt/rh/rh-php70/php.d/10-opcache.ini
  • /etc/opt/rh/rh-php56/php.d/10-opcache.ini

If the values don't pick up, just reboot your server.

Using the right version of PHP from the command line interface

Since each directory can have a different version of PHP, it uses the one from the current working directory.

This will use the PHP version which has been set for the test.example.org domain
* * * * * cd /var/www/virtual/test.example.org/html/ && php test.php >> /tmp/test.log

To manually set the PHP version to be used. Ex.: for CLI use outside the web directory

Create a .phpenv file with the desired PHP version, as follows:

.phpenv file content for PHP 7.1
.phpenv file content for PHP 7.0
.phpenv file content for PHP 5.6