PHP-CLI Required for cron job (WHMCS 7.1.1)

This is not a Webmin bug or issue, but rather a request for support on how to go about solving my problem. It is specific to Virtualmin. I'm not a developer, I know nothing about PHP at all. (But I do cook a mean omelette :) )

I'm trying to install WHMCS, using a South African domain registrar called domains.co.za

Their documentation states the following

  1. Update your domainDotCOZA scheduled crons. (Every 15 minutes) : /usr/bin/php-cli </path/to/your/whmcs>/modules/registrars/domainsDotCOZA/tools/domains_sync.php --poll &> /dev/null (Every 12 hours) : /usr/bin/php-cli </path/to/your/whmcs>/modules/registrars/domainsDotCOZA/tools/domains_sync.php --sync &> /dev/null

There is no path such as /usr/bin/php-cli in my debian 8 virtualmin install.

Feeling brave, I went ahead and tried this:

/usr/bin/php-cgi /home/automatic/public_html/whmcs/modules/registrars/domainsDotCOZA/tools/domains_sync.php --sync &> /dev/null

Which didn't work. Instead of something fun and awesome, I got this:

Content-type: text/html; charset=UTF-8 Site error: the ionCube PHP Loader needs to be installed. This is a widely used PHP extension for running ionCube protected PHP code, website security and malware blocking. Please visit get-loader.ioncube.com for install assistance.

Irony: WHMCS requires Ioncube and so it is installed. I'm now officially lost

If anyone can assist me, I'll send you a video of me making an omelette while singing the South African anthem.

Status: 
Active

Comments

Howdy -- you may want to try a command such as this:

PHPRC=/home/USERNAME/etc/php5 php -q /home/USERNAME/public_html/whmcs/admin/cron.php

Modifying the exact WHMCS script to be executed, but you get the idea... the PHPRC portion in front of that will ensure that it's using that particular domain's php.ini file.

You mentioned that you don't have the php-cli binary, you can install that with this command:

apt-get install php5-cli

Thanks Eric

My apologies. Too much joking and not enough facts:

I meant to say There is no path (despite having php5-cli installed) such as /usr/bin/php-cli in my debian 8 virtualmin install

I'll try the info above, thank you, but what do I do about the bits which say --poll and --sync? I had tried something previously but if I include those, the cron job fails.

You may just want to try "/usr/bin/php" as the path to PHP, that should do the trick.

When using --poll or --sync, are you receiving a particular error when the cron job fails?

Problem solved. Using --poll on the end of your suggested command worked perfectly!

PHPRC=/home/USERNAME/etc/php5 php -q /home/USERNAME/public_html/whmcs/admin/cron.php --poll

Thank you very much!

I think i may have confused myself and everyone else reading this. The issue was related a specific registrar process not necessarily related to cron.php

Adding --poll to the command below is the actual command that I was having issue with. Sorry for using the wrong command in my example.

To clarify:

This command failed in cron:

/usr/bin/php-cgi /home/USERNAME/public_html/whmcs/modules/registrars/domainsDotCOZA/tools/domains_sync.php --poll &> /dev/null

This command worked:

PHPRC=/home/USERNAME/public_html/whmcs/modules/registrars/domainsDotCOZA/tools/domains_sync.php --poll &> /dev/null

Ah, ok. That's not actually a cron job that Virtualmin sets up.