Jump to content

Allowed memory size of 8388608 bytes exhausted


ToonMariner

Recommended Posts

I have had this error before - can't remember how I fixed it.

 

I have some kind of memory leakage somewhere.  The scrits in question send an email; run on my local machine no problems what so ever - run on the server and I get the

 

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 11520 bytes) in /home/sites/site.com/public_html/index.php on line 48

 

all this is doing is sending an email...

 

There is a fair bit of code to look through so I'll post it only if someone wants me too.

 

Increasing the memory is not really practicle - the script should never use that much in the first place.

 

I am using ob_start() / ob_end_flush() if that helps

 

Really stuck on this one guys any help would be VERY much appreciated.

 

Link to comment
Share on other sites

Hey people. I isolated the portion of code that was causing the problem....

<?php
if	(
file_exists($_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI'])
&&
strcmp($_SERVER['SCRIPT_FILENAME'],	$_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI'])	!=	0
&&
$_SERVER['REQUEST_URI']	!=	"/"
)
{
$url	=	$_SERVER['REQUEST_URI'];
include($_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI']);
exit();
}
?>

 

I am using friendly urls and the index.php page is handling all requests - this snippet is near the top of the page and directs to files that actually exist on the site (like cached files etc).

 

Just wondered if anyone could shed some light on why that code would cause the error..

 

Many thanks...

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.