hello
i have one question
i want for example to run a php script without called from a user
like
delete a user after 30 days automaticaly from database
or send an mail automaticaly in users for birthday etc ....
any good idea ?
php working in background without accesing from a user?
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: php working in background without accesing from a user?
... or ...
if you sure that you will have atlast one visitor per day,
store somewhere last timestamp of this "maintance" task (in DB or file), and check from your index page is enough time is passed to call again this task or skip it if not.
Your visitor will wait a litle more before get your page, but other visitors will get it instantly.
But, if takes too much time (more then 5 seconds) visitor may cancel his reqest and leave your task unfinished, you MUST use cron in this case.
if you sure that you will have atlast one visitor per day,
store somewhere last timestamp of this "maintance" task (in DB or file), and check from your index page is enough time is passed to call again this task or skip it if not.
Your visitor will wait a litle more before get your page, but other visitors will get it instantly.
But, if takes too much time (more then 5 seconds) visitor may cancel his reqest and leave your task unfinished, you MUST use cron in this case.
Re: php working in background without accesing from a user?
cron...
i dont know what is that :d
anyone to explain ? or help to create something example ?
i dont know what is that :d
anyone to explain ? or help to create something example ?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: php working in background without accesing from a user?
i check my cpanel and has one cpanel called cron jobs
from there i can set a comand like ?index.php?action=send_mail ?
from there i can set a comand like ?index.php?action=send_mail ?