SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Portland Oergon
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HELP - PHP Timeout - HELP

    I wrote a nice little news forum in PHP w/MySQL I also wrote a mass mailer for the forum but I just discovered that PHP has a default time limit of 30 seconds. (Live and learn..)

    The structure:
    The news forum table entries are copied to a merge queue table. The mass mailer uses fsockopen and fputs to send the email.

    Question:
    Do I need to write something in Java to take the merge queue and send that or how exactly would I go about this?

  2. #2
    get into it! bigduke's Avatar
    Join Date
    May 2004
    Location
    Australia
    Posts
    847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well you can always use the set_time_limit(<int seconds>) to prevent the script from timing out.

  3. #3
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Portland Oergon
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bigduke
    well you can always use the set_time_limit(<int seconds>) to prevent the script from timing out.
    Bad plan stan for a number of reasons:
    1. Not everybody has access to the php.ini file
    2. People would have to modify the php.ini file in order to use the script.
    3. This would just modify the limitation instead of remove it.

    Thanks for the input BigDuke, but that dog ain't going to hunt in the city. I need a real solution but know nothing about the limitations of spawning a bean under php that will operate independant of the php time out limitations and then terminate once the data has been processed. Or even if it is possible.

    This is what I am trying to derive or a better way to go about it.

  4. #4
    SitePoint Guru Ruben K.'s Avatar
    Join Date
    Jun 2005
    Location
    Alkmaar, The Netherlands
    Posts
    693
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use ini_set() to modify php.ini values
    Also, you can't completely remove it.

  5. #5
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Portland Oergon
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ruben K.
    Use ini_set() to modify php.ini values
    Also, you can't completely remove it.
    Hey thanks for the help guys! I did find a way to remove it. ~Sort of~

    set_time_limit() resets the time limit. So it is possible to for instance write a mail server completely in php.

    I wrote a little script that counts up through the IP's and looks for open relays and then adds them to a mySQL database. (Just doodling trying to figure out a solution to the mail list timeout without having to send a ton of email each time)

    Anyway, the set_time_limit() reset solved my mailing list timeout problem and opens the door to scripts that run forever if needed.

    One of the things I love most about PHP is the huge number of included functions. Seems there is a way to do about anything.

    One of the other things I love about php, is the community willing to help each other out. Without the community, there would be no php. Hats off to you two gentlemen, you are da bombs!

  6. #6
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Portland Oergon
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Addendum to last post

    I guess I was wrong...

    The server itself (IIs 4) has a timeout of 300 seconds. The afore mentioned function is only relevant if it is below the server timeout. I think there is a way to remove the server timeout but that places me back into the situation I was in, of having a custom install - config. (Bad thing)

    Thanks for the help but this is probably going to have to be solved by java.

    Using PHP for this aspect of the script is a bit like replacing farmers with ballerinas. The ballerinas are no good for driving a tractors and getting farmers into tights and a little tutu is always more trouble than it was worth. Trust me on that one... :-)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •