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 798669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:00:31+00:00 2026-05-14T23:00:31+00:00

Well basically I may want to execute a script that may take as much

  • 0

Well basically I may want to execute a script that may take as much as 1 hours as well.

What I really want to do is Send SMS to my users using a third party API. So its basically like I supply my script with an array of phone numbers and fire the method to send SMS.

However assuming it take 5 seconds to send 1 SMS and I want to send 1000 SMS which is roughly 1 – 2 hours. I can’t use set_time_limit() because I am on shared host.

One way to do this is store numbers in a session and execute each SMS and use javascript to refresh that page until end. This way I need to keep my browser open and the execution will stop if my Internet Connection is disconnected.

So, Is there any better way to do this ?

Hope I am clear enough to explain what I want? I want to execute a large script that may take hours to execute without getting timeout.

  • 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-05-14T23:00:31+00:00Added an answer on May 14, 2026 at 11:00 pm

    If your host lets you, cron jobs are the best solution. A cron job is basically a normal php script that is automatically run by the web server at a specific time interval. For your needs I would create a script that runs every 5 mins and processes your numbers in batches of 100 (obviously you’ll want to tweak the time interval and batch size to suit). This will keep your server load down and prevent you getting in trouble with your hosting provider for hogging resources.

    In order to track which batch your script should be processing, I would setup a track_batch table. These columns should give you a good indication of how to approach the problem:

    id, date_run, start_record, end_record, final_run

    Essentially:

    • Check to see the date of the last
      batch run. If it isn’t the current date
      (or whatever other identifier you choose to
      use) for the current batch, then
      proceed.
    • If the last batch run was for the current date, then check the
      final_run column to see whether
      you’ve already finished processing
      all the numbers.
    • If you still have numbers to process, use the start and end
      records in conjunction with MySQL’s
      LIMIT to build the db query that your
      script will use to get the next
      batch.
    • Process your numbers.
    • Store all the info from this batch in the track_batch table.
    • If the amount of numbers the query returns is ever less than the maximum
      batch size, you’ve reached the end
      and can set the final_run column to
      1.

    Once you’ve got your script, you’ll need to setup the cron job itself. Shared hosts are likely to have their own custom interfaces for doing this, so they are probably the best people to ask once you’ve got your script working.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 425k
  • Answers 425k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer :last-child means last child, it has no bearing on the… May 15, 2026 at 12:09 pm
  • Editorial Team
    Editorial Team added an answer If I use this approach to store a huge number… May 15, 2026 at 12:09 pm
  • Editorial Team
    Editorial Team added an answer I've gathered a couple of techniques from the MySQL manual.… May 15, 2026 at 12:09 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.