Hi friends,
i want to set up a cron job in php with php code, i don't have access to admin panel(control panel) of site.
so that's why i want to set up a cron job using php code. i already have some code related to cron job but that is not working, can any body have this type of code that can set cron job then pls mail me or send me links......
my mail id: vikas_batra06@yahoo.co.in, vikasbatra2006@gmail.com
cron job in php
Moderator: General Moderators
Best bet would be to find a host who allows you to set up cron jobs.
Don't think it's really possible to manipulate cron itself using php. Not without system calls, anyway.
Failing that, I'd set up a small bit of code which checks, each time somebody requests a page, what the system time is and whether it needs to carry out a cron.
This means that you'll need to :
It also rather adds to the overheads of the scripts.
Don't think it's really possible to manipulate cron itself using php. Not without system calls, anyway.
Failing that, I'd set up a small bit of code which checks, each time somebody requests a page, what the system time is and whether it needs to carry out a cron.
This means that you'll need to :
- a) store the last time that the cron job was run (either in a database or file) - let's call it var_last_time;
b) work out the next time that the cron job needs to run (for instance, the stored time plus 24 hours) - let's call it var_next_time;
c) work out whether the current time is after var_next_time. If it isn't, don't do anything; if it is...
d) ... run the cron job, store var_next_time as var_last_time;
and carry on.
It also rather adds to the overheads of the scripts.
Wow, I stopped development of my PHPCronEmulator because I thought there was no interest in it. 
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.