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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:07:24+00:00 2026-05-10T21:07:24+00:00

Most of my PHP apps have an ob_start at the beginning, runs through all

  • 0

Most of my PHP apps have an ob_start at the beginning, runs through all the code, and then outputs the content, sometimes with some modifications, after everything is done.

ob_start() //Business Logic, etc header->output(); echo apply_post_filter(ob_get_clean()); footer->output(); 

This ensures that PHP errors get displayed within the content part of the website, and that errors don’t interfere with header and session_* calls.

My only problem is that with some large pages PHP runs out of memory. How do I stop this from happening?

Some ideas:

  1. Write all of the buffered content to a temporary file and output that.
  2. When the buffers reaches a certain size, output it. Although this might interfere with the post filter.
  3. Raise the memory limit (thanx @troelskn).

Whats the drawbacks on each of these approaches? Especially raising the memory limit?

  • 1 1 Answer
  • 3 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. 2026-05-10T21:07:25+00:00Added an answer on May 10, 2026 at 9:07 pm

    Can’t you raise the memory limit? Sounds like the best solution to me.

    Edit: Obviously, raising the memory limit just because a script tops out should raise some red flags, but it sounds to me like this is a legitimate case – eg. the script is actually producing rather large chunks of output. As such, you have to store the output somewhere, and memory seems to be the best pick, for both performance and convenience reasons.

    I should note also that the memory limit setting is just that – a limit. Scripts that don’t consume much memory, won’t consume more just because you raise the limit. The main reason for its existence, is to prevent misbehaving/buggy scripts from taking down the entire server. This is something that is important if you have a lot of amateurs hacking away on a shared host (Something PHP has been used a lot for). So if this is your own server, or at least you generally know what you’re doing, there isn’t really any benefit from having a low memory-limit.

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

Sidebar

Related Questions

I have the most basic PHP code with just these 13 lines: <!DOCTYPE html>
I downloaded eclipse for PHP and while code hinting works for most of PHP,
I see alot of {{#variable}} and {{/variable}} used in PHP code. Most specifically in
I'm trying to implement a socket server that will run in most shared PHP
Most of my company's web programming background is PHP, so ASP.NET MVC was a
I build PHP for android using the NDK. Most functions tested so far run
I am running a php website and would like to pull in the most
I want to delete the most recent entry in MySQL using PHP, is there
The Scenario I am using PHP's SimpleXML to parse a blog feed. The most
I'm working on a php site that needs both Japanese and English. In most

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.