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

  • Home
  • SEARCH
  • 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 6589243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:08:52+00:00 2026-05-25T17:08:52+00:00

i have a php function that dispatches a certain post to all the users

  • 0

i have a php function that dispatches a certain post to all the users concerned about that post.

since sometimes there might be up to 100 000 users concerned about that post. it means that this function needs to be repeated 100 000 times thus it will take forever.

i wanna know if there is a way to run the iterations in the background but at the same time, the user who posted the answer doesnt have to wait all that time.

i’m thinking about just telling the user that the email was sent to all the users and instead of waiting till all the posts were sent just run another script in shell in the background from php.

do you guys think it’s the best solution. and if not, whats the best way to do all the processing in the background ?

thanks

  • 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-25T17:08:52+00:00Added an answer on May 25, 2026 at 5:08 pm

    Move your background task into cronjob.

    It could be something like this:

    • You have a list of user to be notified in table
    • create a script that will do:
      • at every script run, it will fetch several rows for processing
      • once row is processed, update it as finished
    • set this script to run at xxx minutes.

    UPDATE

    Actually, there is another trick:

    1. you have list of user to be notified in users_tobenotified table.
    2. you have PHP script as cron that will read on that table and generate text files in some directory called /data/cron/tobenotified. This file contain something like this:

      [date]\t[time]\t[post-entry]\t[user-tobenotified]\t[someotherinfo]
      
    3. have another PHP script as cron that will loop through /data/cron/tobenotified and read each files and then process it.
    4. test … test … test …
    5. profit!
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP function that allows users to pick which categories there post
I have php class and php function that are used together , since im
I have a PHP function that takes a variable number of arguments (using func_num_args()
I have a PHP function that requires can take 3 parameteres... I want to
Is it possible to have a PHP function that is both recursive and anonymous?
I have a php function I wrote that will take a text file and
I have written a PHP function to take a video embed code that has
I have a function that I use on index.php page and I would like
I have a function that finds a regex thingy, then replaces with php code.
I have a jquery-ajax function that sends data to a php script and the

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.