Pages: 12Next
Current Page: 1 of 2
Fatal error (Out of memory)
Posted by: ahmadii (2.144.251.---)
Date: February 06, 2013 10:26AM

Hi all,
i have installed wamp server 2.2
and has many visitors on my site.
after a day or some days of working with wamp on my server, it crashes and gives me error with the following error
Fatal error: Out of memory (allocated 524288) (tried to allocate 393216 bytes)

i have set the memory limit to 0 in php.ini files.
i have 16 GBs of ram and no problem with ram installed on server computer
what should i do ?
thanks

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: RiggsFolly (---.as13285.net)
Date: February 06, 2013 01:39PM

If you are running the 32bit version of Apache and PHP then it can only address 4Gig of memory max, less in real terms.

This out of memory message has happened to me before when I have tried to create arrays that were just to large to be sensible.
I think if you took a look a refactoring the code that is causing the problem that would be your best bet.

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: ahmadii (---.rdns.100tb.com)
Date: February 06, 2013 02:13PM

I'm using wamp server 2.2
and my server is 64 bit
what to do now ?

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: stevenmartin99 (Moderator)
Date: February 06, 2013 04:46PM

Did you look at the error properly.. its only talking about a tiny memory... 0,5MB

You need to alloacte more memory in your script. Its not php as its set to 2mb which you can also increase in the php.ini

left click wamp> php > php.ini

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: ahmadii (199.229.249.---)
Date: February 06, 2013 06:36PM

stevenmartin99 Wrote:
-------------------------------------------------------
> Did you look at the error properly.. its only
> talking about a tiny memory... 0,5MB
>
> You need to alloacte more memory in your script.
> Its not php as its set to 2mb which you can also
> increase in the php.ini
>
> left click wamp> php > php.ini


i set the memory limit to 0 which means unlimited.
i'm using wamp with sql server extension to receive and insert data into sql server.
how can i debug the problem ?
thanks

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: stevenmartin99 (Moderator)
Date: February 06, 2013 06:44PM

no you cant set infinity memory

just use

ini_set('memory_limit','16M');

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: ahmadii (---.rasana.net)
Date: February 06, 2013 07:34PM

wow what a mistake
16M means what? i have 16GB of ram

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: stevenmartin99 (Moderator)
Date: February 06, 2013 07:43PM

Do you need 16gb of memory for a script!?

i think your confused

your script should consume more than 1gb of memory ever...

ini_set('memory_limit','16384M');

if you want 16gb but its not the issue.

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: ahmadii (---.rasana.net)
Date: February 06, 2013 08:19PM

so, why this problem is happening ?
my server is crashing some times, i just don't want this to happen.
what should i do ?

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: ahmadii (2.144.251.---)
Date: February 11, 2013 09:21AM

i have added the line at the beginning of my script.

ini_set('memory_limit','128M');

but the problem is still happening

[Mon Feb 11 08:56:19 2013] [error] [client XXX.XXX.XXX.XXX] PHP Fatal error: Out of memory (allocated 524288) (tried to allocate 393216 bytes) in C:\\wamp\\www\\index.php on line 501

what should i do?

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: stevenmartin99 (Moderator)
Date: February 11, 2013 09:27AM

Again the allocated memory is only .5mb in the error message so it's not php imposing the limit

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: ahmadii (65.19.131.---)
Date: February 11, 2013 09:47AM

I'm using Microsoft Drivers 3.0 for PHP for SQL Server sad smiley

[www.microsoft.com]

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: RiggsFolly (---.as13285.net)
Date: February 11, 2013 10:12AM

ahmadi,

Would you agree this would be a good test?

You have run you script with ini_set('memory_limit','128M');

so if you run it with ini_set('memory_limit','256M'); ( Double the memory ) and it still fails in the same way with the same numbers then it is probably a more compicated problem than you think and just throwing memory at it will not solve it.

Post some of the errors that happen around the one you have posted, maybe there is a clue in what happens before this error is produced.

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: ahmadii (2.144.251.---)
Date: February 11, 2013 10:16AM

thanks
so you mean that the problem is with Microsoft Drivers 3.0 for PHP for SQL Server!?
what should i do now?

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: RiggsFolly (---.as13285.net)
Date: February 11, 2013 10:41AM

No I dont mean that.

I have no idea what the problem is YET.

Post some of your PHP error log and Apache error log ( NOT ALL OF IT ) from around the time you get this error. Lets have a bit more information to work with please.

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: ahmadii (2.144.251.---)
Date: February 11, 2013 10:55AM

all of the error is the same as what i copied before

[Mon Feb 11 08:56:19 2013] [error] [client XXX.XXX.XXX.XXX] PHP Fatal error: Out of memory (allocated 524288) (tried to allocate 393216 bytes) in C:\\wamp\\www\\index.php on line 501
there is no other errors on apache log
where is the php log ?

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: RiggsFolly (---.as13285.net)
Date: February 11, 2013 11:06AM

OK I guess as you are running this as a live server you may have turned off php error reporting.

So lets turn it on temporarily so we can see if there are any other php errors happening that may give us a clue.


go to php.ini ( using the wampmanager menus ) wm-> PHP -> php.ini

This will open up the file in an editor probably notepad.

Find these parameters and set to the values I mention, remember your old values so you can turn it off again when this error is found.

error_reporting = E_ALL
log_errors = On
error_log = "c:/wamp/logs/php_error.log"

This change should write errors to the error_log file but not to the screen


Now run your system until you get the error and lets take a look at the error log

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: ahmadii (2.144.251.---)
Date: February 11, 2013 11:30AM

thanks

on php.ini i checked the parameters
and they are like this

error_reporting = E_ALL
log_errors = On
;error_log = "c:/wamp/logs/php_error.log"

i remove comment from the 3rd line.
but c:/wamp/logs/php_error.log file is not made

the error occurs some times not all the times.

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: RiggsFolly (---.as13285.net)
Date: February 11, 2013 11:33AM

Ok,

So you will have to leave it on until you get the error again and then post some of the file so we can see it.

You could post the code if its not to private or Private message it to me



Edited 1 time(s). Last edit at 02/11/2013 11:33AM by RiggsFolly.

Options: ReplyQuote
Re: Fatal error (Out of memory)
Posted by: ahmadii (2.144.229.---)
Date: February 21, 2013 09:25AM

is it possible to detect the crash and restart wamp server?
i check the php_error.log and no special error occurred just some index problem in some arrays.

Options: ReplyQuote
Pages: 12Next
Current Page: 1 of 2


Sorry, only registered users may post in this forum.