Change default PHP CLI configuration on RunCloud

Runcloud allows you to change the PHP Settings for each application from their Web Panel. But if you’re like me who heavily uses the PHP-CLI then changing config from Web Panel won’t help you.

The PHP configs from their Web Panel only works on PHP-FPM. Meaning that config only gonna works when you visit the PHP application from Web Browser but not gonna effect the PHP-CLI.

Here is an example how to change the memory_limit on PHP-CLI.

First check the current memory_limit using:

php --info | grep 'memory_limit'

The output should show something like this:

As you can see the current PHP memory limit is 256M. But I wants to have 512MB because I’ve some very large scripts.

To change the memory_limit on PHP-CLI first we need to create an additional.ini file (you can name it anything, just make sure it’s end with .ini)

touch /etc/php73rc/conf.d/additional.ini
nano /etc/php73rc/conf.d/additional.ini

Then add the line on that file:

memory_limit = 512M

Now check again using the previous command:

It worked..! This is the safest way to do it. PHP updates won’t affect the changes.

But if you wants to have the same thing on PHP 7.2 or PHP 7.1 then you need to do the same thing on the php72rc and php71rc directory too. Hope this helps.