Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 12th, 2004, 05:02 PM
Authorized User
Join Date: Aug 2003
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Tachyon
Default putting programs on autopilot

How do you make a program check the time and date on its own and perform scheduled tasks?

For example, I want to load a PHP program onto my server that sends a text file to my Email once a day at 4:15pm. How can I make a program do this?

An overworked Web Developer who\'s expected to know everything yet given time to study nothing.
Old March 17th, 2004, 09:37 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts

You can schedule a task. On linux/unix, this generally involves using "cron". On windows, you'll use "Scheduled Tasks".

The PHP script will send the file to your email address.
The task scheduler will run your PHP script once a day at 4:15pm.

You should have PHP installed as a command-line interpreter for this to work. On windows, php.exe comes with the standard .zip download of PHP. On linux, the php executable interpreter is compiled whenever you compile PHP.

You can either put this executable in your system path, or just explicitly call it out.

For example, on my Windows machine, I'd create a scheduled task to run:

C:\php\cli\php.exe -q p:\path\to\my\phpfile.php

Take care,


Similar Threads
Thread Thread Starter Forum Replies Last Post
Image Programs bmains Intro Programming 1 March 9th, 2006 08:54 AM
Help me run my programs Huma Naqvi General .NET 8 September 6th, 2004 01:32 AM
executing programs marjanm PHP How-To 0 August 27th, 2004 06:23 AM
error on programs mxm331 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 June 20th, 2004 08:49 AM
EXE Programs zhenwe1 Servlets 1 December 1st, 2003 10:29 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.