Execute CRON commands with different PHP version

Available PHP versions in the PHP Selector
– php 5.4
– php 5.6
– php 7.1
– php 7.2
– php 7.3
– php 7.x  (latest development) [Very inestable, not installed and not recommended]

Some web applications need some commands to be executed repeatedly, so we should use CRON commands, but some web apps needs a specific PHP version to work or they are uncompatible with new PHP versions.

For this example we are going to use WHMCS which usually needs PHP 5.6 version. This is the command WHMCS recommends us to set-up in cron in order to work:

Imagen del comando que sugiere WHMCS

Now we need to login in our Control Panel and go to contrab:

Imagen de nuestro panel de control

Now we go to custom CRON command and paste the WHMCS command, but we need to change "/usr/bin/php" to "/opt/alt/phpXX/usr/bin/php" and the "XX" means the PHP version we want it to use without dots. For WHMCS we should use PHP 5.6, so we write down this:

Imagen de configuración de nuestro cron

(in green: the part of the command we need to change)
(in blue: the part, without dots, that specifies the PHP version we want to use)

Now we click on save, and optionally in execute and we should be OK and the cron should work!
Cron funcionando correctamente

  • CWP, CPanel, cron, PHP, whmcs
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Change PHP version per folder

Available PHP versions in the PHP Selector– php 5.4– php 5.6– php 7.1– php 7.2– php 7.3– php...

Use always SSL (https://)

To force the loading of a website when the request is without SSL (without https:// in the...

Migrar/Instalar certificados SSL

Como migrar mi certificado (si uso certificado de CloudFlare) Accedemos a el panel antiguo, en...

Solicitar certificado SSL en CloudFlare

Para solicitar el certificado en CloudFlare lo primero es acceder a CloudFlare y al dominio que...