Reputation: 4066
I am currently developing a website. Users can post ads which are added in a database. I would like to delete these ads when they are more than 60 days old. To do so, I will write a PHP script which will find such ads and delete them from the database.
Right, it's easy. But how do I execute this script without loading a page every day in my browser ? How do I ask to my server to execute it automatically regularly ?
Thanks !
PS : I am on a shared server, not a dedicated one. Does it make cron use not possible ?
Upvotes: 2
Views: 8954
Reputation: 27638
Using the following:
cron
to automate the task (more info)wget
to load the web page (more info)/path/to/php /path/to/script.php
- you need to make sure you give this file (script.php) executable permissions. (more info)Edit: You can use cronjobs on a shared server, what control panel is available to you? (cPanel, Plesk, etc.)
Upvotes: 4
Reputation: 4361
Is it Unix/BSD/Linux hosting? Then you are after cron jobs.
Upvotes: 5