Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java MySQL Mail problem

 
Ray Wiltfong
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy?

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.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Is there a way to have php activate a java script

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?
 
Ray Wiltfong
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,

The default max_execution_time for php is 30 seconds for a windows build which is set by the php.ini

And the default timeout on a windows IIs is 300 seconds. Obviously I can extend those times manually but this only moves the problem but soes not solve it and now I have a portability / install issue.

I am looking for a solution that will work with the standard ISAPI php - Portability is a must.

All the java would have to do is activate, run independant of the php and merge a html email from one table into a list of addresses from another table and send that out on port 25.

Just not sure how php hooks java in that, is the java wrapped in the php and will the java stop executing at 30 seconds too? I would think so unless it was a servlett. Way above my pay grade...

Also my SMTP server is not being used as the php is sending the email directly to someone elses smtp server and no it is not timeing out.

BTW - Thanks for the reply!

[ June 20, 2005: Message edited by: Ray Wiltfong ]
[ June 20, 2005: Message edited by: Ray Wiltfong ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic