Automatically running a script daily

Is it possible for a PHP script to be run once every 24 hours without it being directly accessed through a browser?

The reason I’m asking is that I’m planning on writing a script which will check a database on a daily basis and send out any necessary e-mails to clients regarding the expiration date of their hosting plan.

I’d obviously like to make this as automated as I can, and so therefore I was wondering whether it was possible for the script to run on a daily basis without me having to load it up in a browser window. Is this a setting I would need to make on the server? Or is there another way to go about this?

Thanks for your time

Hi,

Which operating system are you using?

Yours, Erik.

In Linux you can use a CRON job, and in windows the task manager. In both OS’s you can run PHP through the CLI. If you are in windows, theres a software here http://www.visualcron.com which you may find very useful as the task manager leaves a lot to be desired for.

Hey Simon.
I’ve been using http://www.nncron.ru/ the lite version for a couple of months with absolutely no complaints. Just had to go over the readme a couple of times and re-read the articles on using PHP through the command line here on sitepoint.
Hope it helps. Oh, I’m running on a windows box.

If you are on win32 I will recommend you the nnCron too, if you are on *nix, then crontab is your best friend here. Both of this run a so called cronjobs, so for example if you want to run some script using a nnCron you will have to open a file cron.tab and add the following line:

0 5 * * * start /min C:\WWW\MyScript\script.php

This means that nnCron will run your script.php every day at 5:00.

Hope that helps, Max.

On a site I’m building, on the first page there is a “Featured Member Of The Day!” This is set up through a php script to randomly selects a new member business every 24 hours from the MySQL DB… We’ve got this all working with the MySQL DB and the tables we’ve set up. Here’s my problem or question…

I would like to automatically have the same “featured Business of the day” notified by an email that they are that day’s featured business! This needs to be automatic and happen at the start of each day exactly when they are made that day’s featured business!..

Though I have been told that this can be “easily” done, I have not been able to find anything or scripts that would enable this. Any Help there???

Some sites are suggesting “CRON” and say it’s installed on most Linux servers, and my host server has a version of that, but I am still at a loss for the php script.

I have missed my deadline for this client for yesterday already… So any help or direction you could point me in would be greatly appreciated!!!

Please send your reply to my email address link.

Thanks,
Kent
:cry: