Saturday, September 5, 2009

Set cron jobs with PHP scripts

Here are some tips to make your PHP script work perfectly:

Official tips



at beginning of your php file(s). This will let your script run until it finishes all jobs and doesn't care about users' stop button :)

Thanks Francesco for this tip :)

Personal tip

As most shared hosting disable functions set_time_limit and/or ignore_user_abort, you'd better don't output anything, or your output should be less than 4KB. Remember not to force your script to output (i.e using flush).

I tried it with shared hosting and my current server (LAMP), and my script which requires 150 seconds to complete works perfectly when set cron job at SetCronJob.

1 comment: