Chapter 41 · Configuration

Cron job, live updates and e-mails

PHP Bid does its background work by itself: it closes ended auctions, creates the sales and sends reminders on normal page views. A cron job is optional.

Background tasks

On page views of the website PHP Bid:

  • closes the auctions that have ended, finds the winners and creates the sales and the commission invoices;
  • sends the "ending soon" reminders to watchers;
  • sends the saved search alerts (at most every 10 minutes).

Optional cron job

On a very quiet site nobody may visit at the moment an auction ends, so the winner is notified only at the next visit. A cron job every 5 minutes makes the closing exact. In your hosting panel (cPanel › Cron Jobs) add:

*/5 * * * * php /home/youraccount/public_html/include/cron.php

If your hosting only allows URLs, call https://www.yourdomain.com/include/cron.php?key=YOUR_KEY. The key protects the URL: it is a 16-character code made from your $SECURITY_SALT. You can print it with this command (replace the text in quotes with your salt from config.php):

php -r 'echo substr(hash_hmac("sha256", "cron", "your-security-salt"), 0, 16);'

Without a valid key the URL answers "Forbidden".

Live updates

The auction pages ask the server for new bids every few seconds, so prices, bid history and countdowns are always current without reloading. No special server software is needed.

E-mails

Members receive e-mails for: account activation, password reset, outbid, auction won, item sold, payment notices, shipping with tracking, new offers and counter-offers, new messages, answers to questions, ending soon and saved search alerts. The e-mails use your website name and colours and the sender of E-mail & privacy.

E-mails are sent with PHP's mail() function after the page has been delivered, so the website stays fast. Members choose which notification e-mails they want in their profile.

Deliverability: use a sender address of your own domain and ask your hosting to set up SPF and DKIM for it, so your e-mails reach the inbox.