WHMCS Cron Job Command Print

  • 0

Make sure you are using the wget or curl commands instead of the default php command. We suggest curl as first option, wget as second option.
For this to work, /crons folder must be web accessible. Sorry, you can't move it to a private location!

Examples for your WHMCS cron job command:

You can use:

curl -s http://domain-name/path-to-ron-folder/cron.php

(requires CURL to be installed in your system)

You can also use:

wget -q -O /dev/null http://domain-name/path-to-cron-folder/cron.php

(requires WGET to be installed in your system)

For WHMCS 7 this solution has been tested and works!
WHMCS 7 appears to block cron requests by automated tools for security. We must add headers and Browser User Agent.

wget -q -O /dev/null --header="Accept: text/html" --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" http://domain-name/path-to-ron-folder/cron.php

or

curl -s -H "Accept: text/html" -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" http://domain-name/path-to-ron-folder/cron.php

Security Note:

We understand exposing your crons directory may cause concern, we need to enforce our anti-piracy protection, but fear not, there is a solution.

Restrict Access by IP using an .htaccess file in the crons directory.

For increased protection, restrict access to a specific set of IPs. This is done by creating a file with the name .htaccess within your WHMCS crons directory, with the following content:

order deny,allow
allow from [your-server-ip]
allow from [your-server-ip]
deny from all

Only one allow from line is sufficient, unless you have more IPs.
You can specify as many different allow from lines as you require. Or you can even allow entire IP subnet's by specifying just the first part of an IP, for example: "12.34.". This is called Htaccess IP Restriction.


Was this answer helpful?

« Back