Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8277503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:42:27+00:00 2026-06-08T08:42:27+00:00

Say my set_time_limit is set to 30 seconds and can’t be changed. I have

  • 0

Say my set_time_limit is set to 30 seconds and can’t be changed. I have an email script in php that will run longer than 30 seconds on 1 cron job (I haven’t reached that time mark yet.) What happens on timeout after 30 seconds? Will the script stop then continue?

If not, I would like to record the elapsed time from the beginning of my script’s loop until it reaches 30 seconds and pause the process then continue.

What is a good way to do this?

Update: what I think might work

function email()
{
  sleep(2); //delays script 2 seconds (time to break script on reset)

  foreach ($emails as $email): 
       // send individual emails with different content
       // takes longer than 30 seconds
   enforeach;

   // on 28 seconds
   return email(); //restarts process
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:42:28+00:00Added an answer on June 8, 2026 at 8:42 am

    Suggested approach:

    function microtime_float()
    {
        list($usec, $sec) = explode(" ", microtime());
        return ((float)$usec + (float)$sec);
    }
    
    $time_start = microtime_float();
    foreach ($emails as $email): 
       // send individual emails with different content
       // takes longer than 30 seconds
    
       $time_curr = microtime_float();
       $time = $time_curr - $time_start;
       if($time > 28){ //if time is bigger than 28 seconds (2 seconds less - just in case)
            break;// we will continue processing the rest of the emails - next time cron will call the script
       }
    enforeach;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a set myset of custom objects that may be equal although
Say I have a class that looks like this (get/set omited): class InfoClass{ String
Say I have a sequence of queries that progressively get more expensive. I can
I have two sets of vectors, set A and set B. Let's say set
Lets say you have a set: foo = {1, 2, 3, 4, 5} In
Lets say I have model inheritance set up in the way defined below. class
Let say I have to parse a hierarchical set of tags <tag> <subtag1 attr1=value1
let's say I have this set of HTML-markup and CSS #CSS .inputhelp_text { background:
So I have this in my PHP script on my test site: $file=clip.mp4; $fake=clip_testing.mp4;
I have this project that has a set price for a certain amount of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.