php working in background without accesing from a user?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jim_php
Forum Newbie
Posts: 16
Joined: Sat Mar 22, 2008 6:16 am

php working in background without accesing from a user?

Post by jim_php »

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 ?
User avatar
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?

Post by Chris Corbyn »

cron :)
mVeliki
Forum Newbie
Posts: 8
Joined: Mon Mar 17, 2008 4:42 pm

Re: php working in background without accesing from a user?

Post by mVeliki »

... 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.
jim_php
Forum Newbie
Posts: 16
Joined: Sat Mar 22, 2008 6:16 am

Re: php working in background without accesing from a user?

Post by jim_php »

cron...
i dont know what is that :d
anyone to explain ? or help to create something example ?
jim_php
Forum Newbie
Posts: 16
Joined: Sat Mar 22, 2008 6:16 am

Re: php working in background without accesing from a user?

Post by jim_php »

i check my cpanel and has one cpanel called cron jobs
from there i can set a comand like ?index.php?action=send_mail ?
Post Reply