* Thus wrote Shawn McKenzie ([EMAIL PROTECTED]):
> 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."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to