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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:40:55+00:00 2026-06-01T03:40:55+00:00

Several days ago, all mail() calls in my custom PHP application cause a 500

  • 0

Several days ago, all mail() calls in my custom PHP application cause a 500 Internal Server Error and the only error logged is Premature end of script headers. Running the file via SSH sometimes returns a segfault. The strange thing is no code changed between the time when the mail() call worked, and stopped working (changes are tracked in Git).

Even though no changes were made to the code, I still went through and did the normal checks (.htaccess, php.ini, custom error handler, etc), just to be safe.

I attempted to diagnose the problem by cutting out code in the application until the issue was pinpointed. However, this did not narrow it down to a specific piece of code, but rather the amount of code loaded into PHP (but not yet run) as the time of the mail() call.

In the trimmed application, I was able to get one mail() call to work, but the second would fail. The first call was immediately before an include call (require has same outcome). The second was at the very beginning of the included file (preceded only be the opening PHP tags).

My original thoughts were it was some sort of memory issue. Oddly, the memory usage required to cause the mail() call to throw an error changes based on which code is kept/removed from the overall application. In case it can still help, the memory usage for the current collection of code before including the file is:

Usage: 3113696
Max: 3352560

The memory usage after including the file is still unknown.

I’ve spoken to my host about the issue, and they claim nothing has changed that would cause this issue.

I have not been able to reproduce this issue in other applications.

Technologies Used

  • PHP 5.3.10 (5.2.17 also affected)
  • MySQLi (specifically custom class extending MySQLi)
  • Suhosin Patch 0.9.10

Error Messages Logged

  • Premature end of script headers: XXX, referer: XXX

TL;DR

What would cause my PHP application to start causing 500 Internal Server Errors when mail() is called after a certain point in the code (but not after any specific call) without any PHP code being changed?

Additional Notes

  • Not a timeout issue – takes less than a second to load
  • Not a memory limit issue – only using ~3MB when it crashes, but I have a 99MB limit
  • 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-01T03:40:56+00:00Added an answer on June 1, 2026 at 3:40 am

    Transferring to a different server with similar configuration solved the problem, so it appears that it was, in fact, and issue with the host’s server (specific cause is unknown, and regrettably, it will probably remain a mystery).

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

Sidebar

Related Questions

Several days ago I had a question about removing index.php from the address bar,
Several days ago I attended a seminar and they were talking about dangerous PHP
It's been several days that I got deadlock issues on a Java application with
I know that cout have buffer several days ago, and when I google it,
Merging in my Mercurial repository is not working like I expected. Several days ago
Small and pretty nasty problem I've seen several days ago, asked to my friend
For several days now I've been messing around with Ajax calls using different combinations
If I don't use GAE development server for several days then it's database vanishes
Several days ago I've decided to assemble Android APKs with Maven under IntellijIDEA. I've
I asked several days ago about finding the most deeply nested lists . I

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.