FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP/Mysql Automated scheduled tasks





ammonkc
I'm not sure if it is even possible to do this. I need to create a simple php web app where users can log data for a future event, then every day the app will query the db and email out reminders for these events. Is it possible to make php/apache run scripts automatically on a schedule? or is this something that can only be done with some shell scripting and cron jobs?
MrBlueSky
You indeed need a cronjob, but you can execute a PHP script as cronjob. So you don't need any special shell scripting. Just create a PHP program which queries the db and send the emails. You can execute this script by using something like "/usr/local/bin/php -q /home/yourhome/somedir/email.php" as cronjob. /usr/local/bin/php will execute your email.php without needing apache, but this does not make much difference in the way you have to create your PHP script. The only difference to keep in mind is: all output will be emailed to you, so you might want to make sure your script only outputs a message when something goes wrong.
ammonkc
Thanks. I thought cron jobs would be the way to go. But I had no idea how to execute the php script and not have it read it as plain text. This should be exactly what I need here.
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.