How to solve problem of time limit excced of 60s in php?
How to solve problem of time limit excced of 60s in php?
Don't have your page do so much.
If there are tasks that you can't cut out completely, create some sort of queueing mechanism. Have the page that's timing out add the jobs to the queue rather than performing the task itself. Process jobs from the queue periodically with a cron script.
The details of creating a queueing mechanism depend on the nature of the tasks, but the general aspects are fairly simple: you need a data store for job information and ways of adding, getting and removing jobs. Usually you store the data necessary to the job in a database table or a file (though in the latter case you'll need to handle concurrent access using e.g. flock).
Last edited by misson; 12-05-2010 at 11:41 PM.
Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.Misson, not Mission.