Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

Info
titleArchives

You are using phpFox version earlier than 4.7.0? Please refer instruction for this article here.

Requires: phpFox 4.47.0+

The file for running phpFox cron jobs is "cron.php" that stored in phpFox root folder (Ex: /var/www/html/phpfox). We suggest that you should config to execute the file every 5 minutes.

...

Note
titleImportant
  • The following tutorial is a basic guide. All hosts have different setups. It could be that the path doesn't work for your server configuration. In that case, please contact your host for the proper path.
  • If your site hasn't been set up SSL, please use the URL with HTTP. In this article, we assume that the site has been set up SSL and all URLs will be used HTTPS

Cron jobs system of phpFox is required the site admin have to set it up manually. Cron jobs of phpFox are used for some core features such as Groups converting, Groups notifications, Downgrade Expired Subscribers... So, it is necessary to set up Cron jobs system to make sure that the phpFox site can work well as design.  Below is some instructions to help the admin can set up the phpFox cron job system easily.

The first step to set up new cron jobs system is getting the URL for cronjob of your phpFox site

 1. Log into AdminCP, and select Cronjob under Settings menu.
Token is like the password for your cronjob, you have to have the correct token on cronjob URL so you can execute the cronjob. Here you can set up the token for yourself, enter any phrase you want to set as token and hit Save Changes

2. You now will obtain your site's cronjob URL with a pre-defined token from the first step.

Image Added


Info

The Cron URL with token will be in format: https://<your-domain>/cron.php?token=<your-defined-token>

Copy the URL.
Next step, we need to configure Cron job on the server. There are several ways to configure Cron job, depend on your web server environment.

...

Setup from cPanel (Mostly use for share hosting)

With cPanel, you can follow the document in the link below to set up a cron job to execute the file "<path_to_phpfox_dir>/cron.php"

https://documentation.cpanel.net/display/ALD/Cron+Jobs


Setup from command line on web server via ssh

Via Web Hosting Control Panel

 cPanel

  • Step 1: To access the Cron Jobs Menu, click on the corresponding icon located on the main screen of your cPanel interface.

Image Added

  • Step 2 (Optional): Enter the email address where the cron output will be sent to in the corresponding field.

Image Added

  • Step 3: Enter the command "curl -s https://<your-domain>/cron.php?token=<your-defined-token>" in the blank field next to the Command field. 
    (https://<your-domain>/cron.php?token=<your-defined-token> is the URL we received in the first part)

Image Added

  • Step 4: Select how often you wish the command to be run by selecting an option in each of the boxes or by selecting a predefined period from the Common Settings drop-down menu. We suggest running the cron job every 10 minutes.

Image Added

  • Step 5: Click on Add New Cron Job to save your changes and set up your cron job.

    Note
    titleNote

    This instruction is just available for cPanel version 56. For other versions please visit the cPanel Cron Job Document to get more information.

DirectAdmin

  • Step 1Log into the DirectAdmin control panel main page, go to the ‘Cronjobs’ page.

Image Added

  • Step 2: Configure cron job: execute the command "curl -s https://<your-domain>/cron.php?token=<your-defined-token>" every 10 minutes
    (https://<your-domain>/cron.php?token=<your-defined-token> is the URL we received in first part).

    Image Added

  • Step 3: Click on "Add" button to add the phpFox cron job.
  • Step 4 (Optional): Set up the email address to receive the cron output.

Image Added

Set up with Command line (Linux server)

  • Step 1: Log in to your web server via SSH access.
  • Step 2: Enter the command below to edit the Cron jobs list on your server 
Code Block
languageapplescript
$ > crontab -e

...

  • Step 3: Add the command below to the list to add the phpFox cron job.
    (https://<your-domain>/cron.php?token=<your-defined-token> is the URL we received in first part).
    With this command, the phpFox Cron job will be executed every 10 minutes.
Code Block
languageapplescript
*/10 * * * * 

...

curl -s https://<your-domain>/cron.php?token=<your-defined-token>
  • Step 4: Save the change and the phpFox cron job have been set up successfully.

Set up on Window Server

Create a schedule task to execute the

...

command "wget https://<your-domain>/cron.php?token=<your-defined-token>
(https://<your-domain>/cron.php?token=<your-defined-token> is the URL we received in first part)