Re: Allowed mem size exhausted
| From: | David Nicholson | Date: | Tue, 05 Aug 2003 16:22:26 +0000 |
| Subject: | Re: Allowed mem size exhausted | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-158310@lists.php.net to get a copy of this message | ||
Hello,
This is a reply to an e-mail that you wrote on Tue, 5 Aug 2003 at
16:45, lines prefixed by '>' were originally written by you.
> 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
Either increase your memory limit in your php.ini or maybe try some
alternatives to chunk_split and see if they do the job any better
(probably unlikely to help but worth a try), maybe wordwrap() (with
the force parameter set to true) or a while loop using substr()?
All the best,
David.
--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/
Free PHP error handling script: www.phpmachine.com/error-handler/
Professional Web Development by David Nicholson
http://www.djnicholson.com/
QuizSender.com - How well do your friends actually know you?
http://www.quizsender.com/