This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I am clueless when it comes to Java but planning to change that.
I wrote a mass mailer plugin for a news forum script. It is all written in PHP. It all works perfectly except that PHP has a 30 second time out.
My Question is: Is there a way to have php activate a java script that can run on it's own beyond the 30 second limit, email the addresses stored in a mysql table and then terminate on it's own when finished?
I would love to hear any ideas on how to solve this problem.
Yes there is. You can integrate PHP into a servlet environment via a SAPI module, or use the PECL Java extension.
But before you rush off to look at that, what is it that is timing out? I ask, because PHP itself doesn't inherently stop processing after 30 seconds, so a change in technology could very well be wasted effort. Does your email server drop the connection after 30 seconds?
Ah right - so its the time allowed to process a request which is the problem. Sound like you undoubtabley need some sort of daemon process to handle this mailing functionality. In which case, just write it as a seperate Java application - you might look at Timers for this. [ June 21, 2005: Message edited by: Paul Sturrock ]