Support

Documentation

Chapter 5. CRON scripts

[Note]Note

None of the CRON scripts are availabe in Akeeba Ticket System Core.

Akeeba Ticket System is a complex system. It needs to be able to run some optional tasks periodically. While system plugins do provide a degree of automation they also require a lot of traffic on your site to even work and they slow down your site. To this end, most of the optional tasks you can run for Akeeba Ticket System are available through standard CRON jobs. These are command line PHP scripts which are supposed to run through PHP CLI, not over the web.

[Warning]Warning

Many hosts claim to offer "CRON jobs" where they only allow you to enter a URL. THESE ARE NOT CRON JOBS! These hosts are lying. When we are talking about CRON jobs we mean the real thing: being able to run command-line scripts based on a schedule. If you are on a host which doesn't provide real CRON jobs –or, worse, asks you an exorbitant amount of money to enable them for you– please change hosts. You wouldn't know it, but real CRON jobs (and excellent performance) is offered by many low- to mid-priced hosts, like our site's host, Rochen (from about $8 per month per site on shared hosting). Besides them there are literally dozens of hosts with real CRON job support and sensible prices. Just shop around; you don't need to raid your wallet, you just need to shop smart.

Full disclosure: Rochen provides our site's hosting for free. We are not affiliated in any other way with Rochen and we do not receive any reward (money or otherwise) for referring clients to them.

The following sections not only describe what each CRON script provided with Akeeba Ticket System does but also gives some generic information on setting up CRON jobs on your server. That said, each server may have a different way for setting up CRON jobs. We cannot know the particulars of all hosting services out there. If you are not sure how to set up a CRON job, please do ask your host. They should be able to help you, point you to the right documentation page or even do it for you.

Setting up CRON jobs, in general

[Note]Note

None of the CRON scripts are availabe in Akeeba Ticket System Core.

The big picture

Setting up a CRON job is generally a fairly simple task. You need to know the path to your PHP CLI executable and the path to your site. All command line scripts you can use with CRON are stored under your site's CLI directory. Assuming the CRON script you need to run is called example.php you need to enter the following CRON command line:

/usr/local/bin/php /home/USER/webroot/cli/example.php

where /usr/local/bin/php is the path to your PHP CLI executable and /home/USER/webroot is the absolute path to your web site's root. You can get this information from your host.

[Important]Important

We cannot know the path to your PHP CLI executable or the absolute path to your web site's root. This is the kind of information that only the people who have set up your server (your host) can possibly know. If they claim that they don't know you have to switch hosts. Lack of such knowledge would mean that your host has no idea how their servers are set up. Would you trust your site's security on people who have no idea how their business works?

[Warning]Warning

Sometimes hosts will give you the path to the PHP CGI binary. This will NOT work with CLI scripts. CGI (Common Gateway Interface) and CLI (Command Line Interface) are a world apart. The former is designed to run scripts which will be served as web pages. The latter is designed to run command line scripts, usually for use with CRON. Some hosts seem oblivious to this fact and will try to persuade you that they are the same thing and your developer doesn't know what he's doing / has a programming error (bug) in his code. These hosts are not only incompetent, they are liars as well. If you come across such a host do yourself a favour and switch hosts. Simply put, do you want to trust your site with people who don't understand how their business works?

Setting up a CRON job in cPanel

Go to your cPanel main page and choose the CRON Jobs icon from the Advanced pane. In the Add New CRON Job box on the page which loads, enter the following information:

Common Settings

Choose the frequency of your backup, for example once per day.

Command

Enter your backup command. Usually, you have to use something like:

/usr/bin/php5-cli /home/myusername/public_html/cli/example.php

where myusername is your account's user name (most probably the same you use to login to cPanel). Do note the path for the PHP command line executable: /usr/bin/php5-cli. This is the default location of the correct executable file for cPanel 11 and later. Your host may use a different path to the executable. If the command never runs, ask them. We can't help you with that; only those who have set up the server know the changes they have made to the default setup.

Finally, click the Add New Cron Job button to activate the CRON job.

Special considerations for HostGator

The location of the PHP CLI binary is /usr/bin/php-cli. This means that your CRON command line should look like:

/usr/bin/php-cli /home/myusername/public_html/cli/example.php