Run a PHP script on a schedule on Windows hosting
Run recurring jobs on HyperDC Windows hosting: create a scheduled task for a PHP script in the client area, choose how often it runs and test it with Run Now.
- Beginner
- 10 min read
- Updated
This guide is not available in your language yet, so it is shown in English.
On this page
A scheduled task runs a job for you at set times, such as sending queued mail or cleaning up old files. On Windows hosting you create tasks in the Scheduled Tasks tab of your service page.
Step 1: Upload the script
Upload your script with File Manager, for example to private/cron.php. Outside httpdocs, visitors cannot open it.
Step 2: Create the task
- Open Scheduled Tasks and select New Task.
- Enter a Name you will recognise.
- Under What it does, choose Run A PHP Script.
- In Address or file, enter the path relative to your hosting account, such as
private/cron.php. - Choose the PHP version and How often it runs. For a daily, weekly or monthly task, write the time as
03:00; it uses the server's time. - Leave Enabled on and select Create Task.
Step 3: Test it
Select Run Now in the task's row, then read the Last run column for the time and the result.
Verify: the script did its job, such as writing the file or sending the message you expected.
Troubleshooting
The task reports an error. Check the path in Address or file: it starts from your hosting account, so a script for your main domain starts with httpdocs/. Then run the script's page once in the browser, if it has one, to see its own message.
Next steps
- Each site's PHP version: add domains and choose the PHP version.
Frequently asked questions
How many tasks can I have?
Your plan sets the number, and Overview shows how many you have.
Which clock do the times use?
The server's time, written as HH:mm, such as 03:00.
Where do I put the script?
Anywhere in your hosting account. Outside httpdocs, visitors cannot open it. Upload it with File Manager.