Fatal Error: Allocated memory size problem...

Fatal Error: Allocated memory size problem...

am 05.03.2007 03:13:42 von Hartleigh Burton

--Apple-Mail-6--667389049
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed

Hi All,

I am having some problems while uploading a file to a MySQL database
relating to file sizes. I have created a script which successfully
uploads most files to the database, however anything roughly over 1MB
in size seems to return a PHP error. I am not trying to upload
anything larger than 15MB. The error I am getting is as follows:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried
to allocate 8439363 bytes) in C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\_dev\mraintranet\settings\common .php on
line 78 (memory_limit = 64M)

I have done a fair bit of reading on the google-net and found that
this is a very common problem. So I started changing the
configuration of the php.ini file to try and resolve it the same way
others have. Currently I have the memory_limit set to 64M, which is
significantly more than the 8M or 12M that is set by default in the
php.ini file. When I bump it up to say 128M or 256M I get the same
error with different exhausted/allocated sizes. I have tried putting
this up to 512M. Example:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried
to allocate 7311167 bytes) in C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\_dev\mraintranet\settings\common .php on
line 77 (memory_limit = 128M)

That is uploading the exact same file (which is approximately 3.5MB).
I don't understand why the 'tried to allocate' size is different. I
also don't understand why the error is occurring on different lines.
I have changed post_max_size to 20M. I upgraded to PHP 5.2.1 after
first noticing the problem and reading that this version of PHP had a
lot of memory bug fixes in it. I am using the following software:

Windows 2000 (SP4)
PHP 5.2.1
Apache 2.2.4
MySQL 5.0.27

If anyone has any ideas on how to solve this then the help is greatly
appreciated.



Regards,
Hartleigh Burton.
--Apple-Mail-6--667389049--

Re: Fatal Error: Allocated memory size problem...

am 05.03.2007 06:57:37 von bedul

same here not work for me
----- Original Message -----
From: "Hartleigh Burton"
To:
Sent: Monday, March 05, 2007 9:13 AM
Subject: [PHP-WIN] Fatal Error: Allocated memory size problem...


> Hi All,
>
> I am having some problems while uploading a file to a MySQL database
> relating to file sizes. I have created a script which successfully
> uploads most files to the database, however anything roughly over 1MB
> in size seems to return a PHP error. I am not trying to upload
> anything larger than 15MB. The error I am getting is as follows:

that's weird.. i upload a pic 1mb more.. it error.. database say.. mysql is
DEAD!! or something like that

to avoid this.. i upload the file to a folder not to database.. is not what
i want but it worked..
why not try upload to localhost instead?

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

RE: Fatal Error: Allocated memory size problem...

am 05.03.2007 08:22:00 von Gustav Wiberg

Hi there!

What fieldtype do you try to store the file in?

Best regards
/Gustav Wiberg=20


-----Original Message-----
From: Hartleigh Burton [mailto:hburton@mraentertainment.com]=20
Sent: Monday, March 05, 2007 3:14 AM
To: php-windows@lists.php.net
Subject: [PHP-WIN] Fatal Error: Allocated memory size problem...

Hi All,

I am having some problems while uploading a file to a MySQL database =20
relating to file sizes. I have created a script which successfully =20
uploads most files to the database, however anything roughly over 1MB =20
in size seems to return a PHP error. I am not trying to upload =20
anything larger than 15MB. The error I am getting is as follows:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried =20
to allocate 8439363 bytes) in C:\Program Files\Apache Software =20
Foundation\Apache2.2\htdocs\_dev\mraintranet\settings\common .php on =20
line 78 (memory_limit =3D 64M)

I have done a fair bit of reading on the google-net and found that =20
this is a very common problem. So I started changing the =20
configuration of the php.ini file to try and resolve it the same way =20
others have. Currently I have the memory_limit set to 64M, which is =20
significantly more than the 8M or 12M that is set by default in the =20
php.ini file. When I bump it up to say 128M or 256M I get the same =20
error with different exhausted/allocated sizes. I have tried putting =20
this up to 512M. Example:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried =20
to allocate 7311167 bytes) in C:\Program Files\Apache Software =20
Foundation\Apache2.2\htdocs\_dev\mraintranet\settings\common .php on =20
line 77 (memory_limit =3D 128M)

That is uploading the exact same file (which is approximately 3.5MB). =20
I don't understand why the 'tried to allocate' size is different. I =20
also don't understand why the error is occurring on different lines. =20
I have changed post_max_size to 20M. I upgraded to PHP 5.2.1 after =20
first noticing the problem and reading that this version of PHP had a =20
lot of memory bug fixes in it. I am using the following software:

Windows 2000 (SP4)
PHP 5.2.1
Apache 2.2.4
MySQL 5.0.27

If anyone has any ideas on how to solve this then the help is greatly =20
appreciated.



Regards,
Hartleigh Burton.

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

Re: [PHP-WIN] Fatal Error: Allocated memory size problem...

am 05.03.2007 08:50:35 von bedul

----- Original Message -----
From: "Gustav Wiberg"
To: "'Hartleigh Burton'" ;

Sent: Monday, March 05, 2007 2:22 PM
Subject: RE: [PHP-WIN] Fatal Error: Allocated memory size problem...


Hi there!

What fieldtype do you try to store the file in?

[bedul]
since i have same problem. i hope my answer are same as Hartleigh Burton
i use longblob.. it says able to take 2mb?? but i try to execute with 1mb..
it false?
====================================
Best regards
/Gustav Wiberg

-----Original Message-----
From: Hartleigh Burton [mailto:hburton@mraentertainment.com]
Sent: Monday, March 05, 2007 3:14 AM
To: php-windows@lists.php.net
Subject: [PHP-WIN] Fatal Error: Allocated memory size problem...

Hi All,

I am having some problems while uploading a file to a MySQL database
relating to file sizes. I have created a script which successfully
uploads most files to the database, however anything roughly over 1MB
in size seems to return a PHP error. I am not trying to upload
anything larger than 15MB. The error I am getting is as follows:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried
to allocate 8439363 bytes) in C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\_dev\mraintranet\settings\common .php on
line 78 (memory_limit = 64M)

I have done a fair bit of reading on the google-net and found that
this is a very common problem. So I started changing the
configuration of the php.ini file to try and resolve it the same way
others have. Currently I have the memory_limit set to 64M, which is
significantly more than the 8M or 12M that is set by default in the
php.ini file. When I bump it up to say 128M or 256M I get the same
error with different exhausted/allocated sizes. I have tried putting
this up to 512M. Example:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried
to allocate 7311167 bytes) in C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\_dev\mraintranet\settings\common .php on
line 77 (memory_limit = 128M)

That is uploading the exact same file (which is approximately 3.5MB).
I don't understand why the 'tried to allocate' size is different. I
also don't understand why the error is occurring on different lines.
I have changed post_max_size to 20M. I upgraded to PHP 5.2.1 after
first noticing the problem and reading that this version of PHP had a
lot of memory bug fixes in it. I am using the following software:

Windows 2000 (SP4)
PHP 5.2.1
Apache 2.2.4
MySQL 5.0.27

If anyone has any ideas on how to solve this then the help is greatly
appreciated.



Regards,
Hartleigh Burton.

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

RE: Fatal Error: Allocated memory size problem...

am 05.03.2007 11:27:00 von Gustav Wiberg

Hi there!

Maybe this link may help?
http://codex.gallery2.org/Gallery1:FAQ#Why_do_I_get_the_erro r_Allowed_memor=
y_size_of_Xxx_bytes_exhausted.3F

Best regards
/Gustav Wiberg=20

-----Original Message-----
From: bedul [mailto:landavia81@gmail.com]=20
Sent: Monday, March 05, 2007 8:51 AM
To: Gustav Wiberg
Cc: php-windows@lists.php.net; php-db@lists.php.net
Subject: Re: [PHP-WIN] Fatal Error: Allocated memory size problem...
Importance: High


----- Original Message -----
From: "Gustav Wiberg"
To: "'Hartleigh Burton'" ;

Sent: Monday, March 05, 2007 2:22 PM
Subject: RE: [PHP-WIN] Fatal Error: Allocated memory size problem...


Hi there!

What fieldtype do you try to store the file in?

[bedul]
since i have same problem. i hope my answer are same as Hartleigh Burton
i use longblob.. it says able to take 2mb?? but i try to execute with 1mb..
it false?
==================== =====3D=
===========3D
Best regards
/Gustav Wiberg

-----Original Message-----
From: Hartleigh Burton [mailto:hburton@mraentertainment.com]
Sent: Monday, March 05, 2007 3:14 AM
To: php-windows@lists.php.net
Subject: [PHP-WIN] Fatal Error: Allocated memory size problem...

Hi All,

I am having some problems while uploading a file to a MySQL database
relating to file sizes. I have created a script which successfully
uploads most files to the database, however anything roughly over 1MB
in size seems to return a PHP error. I am not trying to upload
anything larger than 15MB. The error I am getting is as follows:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried
to allocate 8439363 bytes) in C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\_dev\mraintranet\settings\common .php on
line 78 (memory_limit =3D 64M)

I have done a fair bit of reading on the google-net and found that
this is a very common problem. So I started changing the
configuration of the php.ini file to try and resolve it the same way
others have. Currently I have the memory_limit set to 64M, which is
significantly more than the 8M or 12M that is set by default in the
php.ini file. When I bump it up to say 128M or 256M I get the same
error with different exhausted/allocated sizes. I have tried putting
this up to 512M. Example:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried
to allocate 7311167 bytes) in C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\_dev\mraintranet\settings\common .php on
line 77 (memory_limit =3D 128M)

That is uploading the exact same file (which is approximately 3.5MB).
I don't understand why the 'tried to allocate' size is different. I
also don't understand why the error is occurring on different lines.
I have changed post_max_size to 20M. I upgraded to PHP 5.2.1 after
first noticing the problem and reading that this version of PHP had a
lot of memory bug fixes in it. I am using the following software:

Windows 2000 (SP4)
PHP 5.2.1
Apache 2.2.4
MySQL 5.0.27

If anyone has any ideas on how to solve this then the help is greatly
appreciated.



Regards,
Hartleigh Burton.

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

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

Re: Fatal Error: Allocated memory size problem...

am 05.03.2007 15:41:51 von Stut

Hartleigh Burton wrote:
> I am having some problems while uploading a file to a MySQL database
> relating to file sizes. I have created a script which successfully
> uploads most files to the database, however anything roughly over 1MB in
> size seems to return a PHP error. I am not trying to upload anything
> larger than 15MB. The error I am getting is as follows:
>
> Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to
> allocate 8439363 bytes) in C:\Program Files\Apache Software
> Foundation\Apache2.2\htdocs\_dev\mraintranet\settings\common .php on line
> 78 (memory_limit = 64M)
>
> I have done a fair bit of reading on the google-net and found that this
> is a very common problem. So I started changing the configuration of the
> php.ini file to try and resolve it the same way others have. Currently I
> have the memory_limit set to 64M, which is significantly more than the
> 8M or 12M that is set by default in the php.ini file. When I bump it up
> to say 128M or 256M I get the same error with different
> exhausted/allocated sizes. I have tried putting this up to 512M. Example:
>
> Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
> allocate 7311167 bytes) in C:\Program Files\Apache Software
> Foundation\Apache2.2\htdocs\_dev\mraintranet\settings\common .php on line
> 77 (memory_limit = 128M)
>
> That is uploading the exact same file (which is approximately 3.5MB). I
> don't understand why the 'tried to allocate' size is different. I also
> don't understand why the error is occurring on different lines. I have
> changed post_max_size to 20M. I upgraded to PHP 5.2.1 after first
> noticing the problem and reading that this version of PHP had a lot of
> memory bug fixes in it. I am using the following software:
>
> Windows 2000 (SP4)
> PHP 5.2.1
> Apache 2.2.4
> MySQL 5.0.27
>
> If anyone has any ideas on how to solve this then the help is greatly
> appreciated.

Show us your script. Chances are that you have a bug that is causing
lots of memory to be allocated.

Incidentally, the "tried to allocate n bytes" message indicates how much
it was trying to allocate when it ran out. If you change the
memory_limit then I'm not surprised that this value changes.

-Stut

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

Re: Fatal Error: Allocated memory size problem...

am 05.03.2007 23:11:04 von Hartleigh Burton

--Apple-Mail-1--595547849
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed

I am using a longblob to store the file data, however this seems to
be a php error rather than a mysql error.



On 05/03/2007, at 5:22 PM, Gustav Wiberg wrote:

> Hi there!
>
> What fieldtype do you try to store the file in?
>
> Best regards
> /Gustav Wiberg
>
>
> -----Original Message-----
> From: Hartleigh Burton [mailto:hburton@mraentertainment.com]
> Sent: Monday, March 05, 2007 3:14 AM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Fatal Error: Allocated memory size problem...
>
> Hi All,
>
> I am having some problems while uploading a file to a MySQL database
> relating to file sizes. I have created a script which successfully
> uploads most files to the database, however anything roughly over 1MB
> in size seems to return a PHP error. I am not trying to upload
> anything larger than 15MB. The error I am getting is as follows:
>
> Fatal error: Allowed memory size of 67108864 bytes exhausted (tried
> to allocate 8439363 bytes) in C:\Program Files\Apache Software
> Foundation\Apache2.2\htdocs\_dev\mraintranet\settings\common .php on
> line 78 (memory_limit = 64M)
>
> I have done a fair bit of reading on the google-net and found that
> this is a very common problem. So I started changing the
> configuration of the php.ini file to try and resolve it the same way
> others have. Currently I have the memory_limit set to 64M, which is
> significantly more than the 8M or 12M that is set by default in the
> php.ini file. When I bump it up to say 128M or 256M I get the same
> error with different exhausted/allocated sizes. I have tried putting
> this up to 512M. Example:
>
> Fatal error: Allowed memory size of 134217728 bytes exhausted (tried
> to allocate 7311167 bytes) in C:\Program Files\Apache Software
> Foundation\Apache2.2\htdocs\_dev\mraintranet\settings\common .php on
> line 77 (memory_limit = 128M)
>
> That is uploading the exact same file (which is approximately 3.5MB).
> I don't understand why the 'tried to allocate' size is different. I
> also don't understand why the error is occurring on different lines.
> I have changed post_max_size to 20M. I upgraded to PHP 5.2.1 after
> first noticing the problem and reading that this version of PHP had a
> lot of memory bug fixes in it. I am using the following software:
>
> Windows 2000 (SP4)
> PHP 5.2.1
> Apache 2.2.4
> MySQL 5.0.27
>
> If anyone has any ideas on how to solve this then the help is greatly
> appreciated.
>
>
>
> Regards,
> Hartleigh Burton.
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>





Regards,
Hartleigh Burton
Resident Geek

MRA Entertainment Pty Ltd
5 Dividend St | Mansfield | QLD 4122 | Australia
Phone: (07) 3457 5041
Fax: (07) 3349 8806
Mobile: 0421 646 978

www.mraentertainment.com



--Apple-Mail-1--595547849--

Re: Fatal Error: Allocated memory size problem...

am 06.03.2007 02:40:13 von Hartleigh Burton

--Apple-Mail-6--582998380
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed

Hi Stut,

You were in the right area thats for sure. I had a look through where
the script was ending a bit closer... there is a function i use to
make the sql query safe for inserts if magic quotes is not on thats
something like this...

function WalkAddSlashes(&$item, $key) {
if(!is_array($item)) {
$item = addslashes($item);
$item = str_replace("\"",""",$item);
}
}

The strange thing is that this function was not being called at all
from this particular script, however the include file was being
loaded. So I made sure that there were minimalist includes for this
particular script which cut out any unnecessary junk. This solved the
php memory problem which then brought me to a MySQL error where the
max_allowed_packet size was too small which was a simple fix.

Thanks for the help everyone, greatly appreciate it.

On 06/03/2007, at 12:41 AM, Stut wrote:

> Hartleigh Burton wrote:
>> I am having some problems while uploading a file to a MySQL
>> database relating to file sizes. I have created a script which
>> successfully uploads most files to the database, however anything
>> roughly over 1MB in size seems to return a PHP error. I am not
>> trying to upload anything larger than 15MB. The error I am getting
>> is as follows:
>> Fatal error: Allowed memory size of 67108864 bytes exhausted
>> (tried to allocate 8439363 bytes) in C:\Program Files\Apache
>> Software Foundation\Apache2.2\htdocs\_dev\mraintranet\settings
>> \common.php on line 78 (memory_limit = 64M)
>> I have done a fair bit of reading on the google-net and found that
>> this is a very common problem. So I started changing the
>> configuration of the php.ini file to try and resolve it the same
>> way others have. Currently I have the memory_limit set to 64M,
>> which is significantly more than the 8M or 12M that is set by
>> default in the php.ini file. When I bump it up to say 128M or 256M
>> I get the same error with different exhausted/allocated sizes. I
>> have tried putting this up to 512M. Example:
>> Fatal error: Allowed memory size of 134217728 bytes exhausted
>> (tried to allocate 7311167 bytes) in C:\Program Files\Apache
>> Software Foundation\Apache2.2\htdocs\_dev\mraintranet\settings
>> \common.php on line 77 (memory_limit = 128M)
>> That is uploading the exact same file (which is approximately
>> 3.5MB). I don't understand why the 'tried to allocate' size is
>> different. I also don't understand why the error is occurring on
>> different lines. I have changed post_max_size to 20M. I upgraded
>> to PHP 5.2.1 after first noticing the problem and reading that
>> this version of PHP had a lot of memory bug fixes in it. I am
>> using the following software:
>> Windows 2000 (SP4)
>> PHP 5.2.1
>> Apache 2.2.4
>> MySQL 5.0.27
>> If anyone has any ideas on how to solve this then the help is
>> greatly appreciated.
>
> Show us your script. Chances are that you have a bug that is
> causing lots of memory to be allocated.
>
> Incidentally, the "tried to allocate n bytes" message indicates how
> much it was trying to allocate when it ran out. If you change the
> memory_limit then I'm not surprised that this value changes.
>
> -Stut
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>





Regards,
Hartleigh Burton
Resident Geek

MRA Entertainment Pty Ltd
5 Dividend St | Mansfield | QLD 4122 | Australia
Phone: (07) 3457 5041
Fax: (07) 3349 8806
Mobile: 0421 646 978

www.mraentertainment.com



--Apple-Mail-6--582998380--

Re: Fatal Error: Allocated memory size problem...

am 06.03.2007 08:23:47 von Stut

Hartleigh Burton wrote:
> You were in the right area thats for sure. I had a look through where
> the script was ending a bit closer... there is a function i use to make
> the sql query safe for inserts if magic quotes is not on thats something
> like this...
>
> function WalkAddSlashes(&$item, $key) {
> if(!is_array($item)) {
> $item = addslashes($item);
> $item = str_replace("\"",""",$item);
> }
> }

I'm happy you solved your problem, but I think it's worth pointing out
that your function is flawed if the intention is to make the data safe
for inclusion in a MySQL query. Addslashes() doesn't do anywhere near
enough, you should be using mysql_real_escape_string() instead.

-Stut

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