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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:19:16+00:00 2026-05-20T18:19:16+00:00

I have a few questions about PHP memory usage. I’m going to run some

  • 0

I have a few questions about PHP memory usage. I’m going to run some tests on my own, but getting various advice is quite helpful.

I recently learned about the PHP function ignore_user_abort(), which allows a script to continue running even if a user closes the page. I was thinking about using this for my E-mail Newsletter tool instead of Cron jobs, as configuring Cron jobs has various pitfuls. The alternative approach of making a user stay on the page, using AJAX requests, and running part of the script after the page content has been delivered all have issues as well.

My solution would be to run call ignore_user_abort(true) at the beginning of the script, and at the end after the content has been generated, call flush() for good measure, and then run the newsletter script. Alternatively, do this with an AJAX.

First of all, does anyone see issues with that approach?

Second of all, if I used the script with no time limit set, and a while loop going through each email, what would the memory usage be like if I did it in one go? Since I’d be overwriting variables, not using new ones, I’d think it would be low.

Third, because if I am sending a large volume of emails, say 1000 per run, I don’t want to overload my mail server. With my cron job, I run the script every 5 minutes, sending a batch of 50 emails out. If I was doing this in a single pass, could I send out 50 emails, call sleep for say 5 minutes, and then continue for another 50 emails? If so, what is the script memory usage like during the sleep period? Would this be an efficient method?

What I’m really trying to do here is come up with a way to create a newsletter tool that doesn’t require the complex (for non-technical folks) task of setting up a Cron job (Which isn’t even an option on shared hosts), and doesn’t require the user to keep their browser open on a single page.

Any ideas suggestions or feedback is welcome. 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-20T18:19:17+00:00Added an answer on May 20, 2026 at 6:19 pm

    At a former job we wrote a daemon for a critical function in PHP, not exactly what you describe but similar enough — certainly with loops and sleeps. We were very doubtful about its long-term stability — specially in memory management–, so we subjected it to pretty tough stress testing. Results were excellent, and the code was put to production and running flawlessly for months if not years.

    Caveats:

    • IIRC, PHP has a counter-based garbage
      collector. This means that, unlike in
      Java, two objects referencing each
      other will stay in memory even if not
      accessible by your program. You need
      to be careful about this when you
      ‘abandon’ your objects.
    • Web servers
      often have mechanisms to kill
      long-running scripts. This may defeat
      your purpose here — specially if the
      server’s configuration can’t be
      tuned.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a few questions about using mysql and oracle in a PHP app.
I have few questions about this code: <?php $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv =
I have a few questions about security using PHP, I dont want to use
I have seen quite a few questions about this but cant seem to find
I have a few questions about data synchronization. The architecture does not seem to
I've been hearing about triggers, and I have a few questions. What are triggers?
i have a few questions about flash web sites. are their pages done using
I have a few questions about the linkage from the following variables. By examples
I have a few questions about git. I have read a couple of documents
I have quite a few questions to ask about these issues. I'm an intern

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.