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


PHP creating scheduled tasks?





Diablosblizz
I'm exploring new ideas with my server and I have gotten the thought of a calendar system between the two computers. I am a very forgetful person, so the fact that my computer could remind me of what I need to do, such as a upcoming events for my technical productions crew at my school.

So, I am aware that PHP can create batch files with net send within it, but can PHP create scheduled tasks within the computer itself? If not, is there anyway I can get PHP to check if it's a certain time and if it is to execute a file?

Thanks for the support.
Kind regards.
rvec
you could make a cron run every hour to see if something is set for that hour. Or if it's your own server you could even do it every min.

Or you could make a php script run in the background (directly over php instead of with apache). And make that check the time and database once every while.
Diablosblizz
So you're saying have a central database containing all of my information then using PHP to create a file, execute it, then delete it? That actually sounds like a good idea, and it 100% possible from my view.

Only problem is, can PHP execute .exe (or .batch in this case) files? EDIT: Exec seems to work perfectly fine.

Merci rvec, once again to the rescue! EDIT EDIT: Is there anyway to get PHP to execute it itself, not through Apache? I know there is a way, but I can't figure it out.

I've tried:

Code:
CD C:\xampp\PHP\
php -q C:\xampp\htdocs\file.php


Is this correct?
rvec
i have no idea how it would work in windows, but in linux I use this:
/usr/bin/php -q .....

So I guess you'd have to cd to the php dir, and use php -q ... or use the full path to the php file.
Diablosblizz
Unfortuantely, nope. It doesn't appear to do anything, no sucess message, nor no error message. Not too sure on how to fix this, but I've posted in XAMPP forums asking for support, hopefully somebody knows.

Thanks for your support!
kv
Diablosblizz wrote:
So you're saying have a central database containing all of my information then using PHP to create a file, execute it, then delete it? That actually sounds like a good idea, and it 100% possible from my view.

Only problem is, can PHP execute .exe (or .batch in this case) files? EDIT: Exec seems to work perfectly fine.

Merci rvec, once again to the rescue! EDIT EDIT: Is there anyway to get PHP to execute it itself, not through Apache? I know there is a way, but I can't figure it out.

I've tried:

Code:
CD C:\xampp\PHP\
php -q C:\xampp\htdocs\file.php


Is this correct?


Yes, in case of windows. For some versions of php, you may have to use phpcli though. On unix platforms, just put this line at top of your php script.

Code:

# !/usr/bin/php


Then set execute permission for the script. You can run it as any normal shell script or executable, even set it as cron job.
Related topics
html login system
751 Useful Windows XP Files
Ways to improve Battery Life
how long does it take to defrag my HDD
A very good PHP MySQL Tutorial
Forum
Useful run commands
what can a cron job do for you?
how do i set up a free host?
Need Help with Mambo!
script show off- simplecron(tmp name, might change)
PHP/Mysql Automated scheduled tasks
Disc Cleanup on Server 2003 - Scheduled Task
Can I add tasks to Windows Scheduled Tasks - Using PHP?
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.