Re: Allowed mem size exhausted

From: Date: Tue, 05 Aug 2003 16:58:43 +0000
Subject: Re: Allowed mem size exhausted
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-158315@lists.php.net to get a copy of this message
* Thus wrote Shawn McKenzie (nospam@mckenzies.net): > I have the following code that generates the following error. I am using > this code to prepare a zip or tar.gz file as an email attachment. Can > someone suggest a better / more efficient way to do this and maybe avoid the > error??? > > I believe that the file that generated this error was about 1.8MB. > > 6 $fp = fopen($path.$filename, "r"); > 7 $content = fread($fp, filesize($path.$filename)); > 8 $attachment = base64_encode($content); > 9 $attachment = chunk_split($attachment); > > Fatal error: Allowed memory size of 8388608 bytes exhausted at (null):0 > (tried to allocate 2228273 bytes) in > /home/user/public_html/dir/subdir/include/functions.php on line 9 I would prepare the file on disk instead of memory. If you do increase the memory to handle bigger files, what happens when you get 10 requests at the same time? about 80MB of memory used. Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#158315) next »