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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:50:41+00:00 2026-05-21T02:50:41+00:00

I have a batch email process that sends about 30,000 email messages. I have

  • 0

I have a batch email process that sends about 30,000 email messages. I have ran into a strange problem where it gets to about 85% completion of the process and then the email start failing with the message Could not execute: /usr/sbin/sendmail I am using a library called PHPMailer 1.73 and the relevant code where the error message comes from is

if(!@$mail = popen($sendmail, "w"))
{
    $this->SetError($this->Lang("execute") . $this->Sendmail);
    return false;
}

The value of $sendmail is of the form: /usr/sbin/sendmail -oi -f support1@example.com -t

I have set_time_limit(0); so the script will not timeout.

Is there anyway to figure out why all of a sudden popen() starts failing? Could the OS be running out of file descriptors or some other limit being reached?

How should I resolve this? Should I have it sleep and then retry the popen() several times before failing?

Update: Thanks to the suggestion of Marko to check out proc_open() I found on the proc_open documentation a comment that if it returns FALSE it probably means that you ran out of file descriptors or you are out of memory. I found that my process was taking 20G of memory. But how could it take that much memory if memory_limit is set at 64M? Well, it seems that running external programs with exec(), popen() or proc_open() do NOT count against PHP’s memory limit. See this SO question for more info on that, Debugging memory usage in mod_php. I’m still not sure how this is happening but I suspect some sort of memory leak.

In summary, popen() and proc_open() can return FALSE if you are out of file descriptors or out of memory.

  • 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-21T02:50:41+00:00Added an answer on May 21, 2026 at 2:50 am

    I would recommend to use proc_open instead. It is slightly more complex to use, but gives you access to stdout and stderr. The messages on this two pipes will save you a lot of debugging time.

    How to use, just read the examples and comments in the PHP documentation.

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

Sidebar

Related Questions

I have a daily batch process that involves selecting out a large number of
I have a batch file that was created for an Oracle database that I'm
We have 50+ Java batch processes that run at different times of the day.
I have a nightly batch job that can tell if it has failed. I
I have a service that sometimes calls a batch file. The batch file takes
I have an application running only on Windows and a batch file that launches
I have a bunch of files that get updated in the folder C:\Email. These
I have a query, or batch of queries, that I just can't get to
I have a batch file (in windows XP, with command extension activated) with the
For example, suppose I have a batch file called 'test.cmd' and it simply contains:

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.