Valid for Web Hosting and Managed Dedicated Servers.

Cron jobs are a powerful tool for automating recurring tasks. However, if they are configured incorrectly, they can affect the performance of your website, or not be executed at all.

In this article, you will learn which points you need to bear in mind when creating and managing cron jobs.

1. Do not select an execution interval that is too short

Avoid too short intervals between executions. We recommend allowing at least 5 minutes to elapse before a cron job is executed again.

  • Background: If executed too frequently (e.g. every minute), processes may overlap during periods of high server load. This can lead to parallel executions that further slow down the server and block processes.

2. Set up error notification (MAILTO)

To avoid having to manually review the log files in the event of problems, you should have error messages sent to you by email.

To do this, add the variable MAILTO to the first line of your crontab file:

MAILTO=john.doe@example.com

3. Use the correct PHP version

If you want to execute PHP scripts directly, you must specify the absolute path to the PHP interpreter. Also make sure that you are using a PHP version that is compatible with your script.

Always use the full path to the binary file (e.g. /usr/bin/php8.3).

PHP version Path to interpreter  
PHP 8.4 /usr/bin/php8.4  
PHP 8.3 /usr/bin/php8.3  
PHP 8.2 /usr/bin/php8.2  
Legacy (Older) /usr/bin/php8.1
/usr/bin/php8.0
/usr/bin/php7.4
/usr/bin/php7.3
/usr/bin/php7.2
/usr/bin/php7.1
/usr/bin/php5.5
/usr/bin/php5.4
/usr/bin/php5.2
/usr/bin/php4.4
Ideally, use the latest versions.

Note

/usr/bin/php refers to PHP 4.4 (via symlink). To avoid incompatibilities, we recommend explicitly specifying the version number (e.g. php8.3).

4. Specify the absolute path to the script

The cron daemon does not recognise your current folder. Therefore, always enter the complete (absolute) path to your script. The path depends on the creation date of your contract.

An example of a cron job line (executed every 10 minutes) is as follows:

A) Hosting contracts from September 15, 2025 (New)

*/10 * * * * * /usr/bin/php8.2 -f /home/www/test.php

B) Hosting contracts that were created before September 15, 2025

*/10 * * * * * /usr/bin/php8.2 -f /homepages/12/d12345678/htdocs/test.php

 

Tip: If you are unsure what your path is, see the article Determining the absolute path (document root) of your webspace.

5. Use your own php.ini settings (HTTP request)

If you call a PHP script directly via the interpreter (as described above), individual settings in your php.ini are ignored.

If your script requires special settings from php.ini (e.g. memory_limit or max_execution_time), you should execute the cron job through an HTTP request via cURL instead. This simulates a call via the web browser.

Example:

*/10 * * * * * /usr/bin/curl -s https://example.com/test.php > /dev/null

 

Use with directory protection

For shared hosting packages, we recommend storing scripts in directory-protected folders for security reasons. To enable curl to access these, you must pass the username and password with the -u parameter.

Example with authentication:

*/10 * * * * * /usr/bin/curl -s -u user:password https://example.com/test.php > /dev/null