tags:

views:

278

answers:

4

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 136753 bytes) in /home/alien/Desktop/1/scanner.php on line 166

this is 166 line of the PHP code:

 $text[$i] =  curl_multi_getcontent ($curl[$i]);

is here any way to get around this by emptying RAM or something, sorry I'm not a programmer

A: 

You can increase the amount of memory available for each individual PHP request through php.ini. See the documentation of memory_limit for details.

However, take heed of the warning there: This helps prevent poorly written scripts for eating up all available memory on a server. Maybe your first course of action should be to go and talk to the developer of this code.

Thomas
+1  A: 

There is not a free_ram() function in PHP. You do a few options:

  • Increase the memory limit available to php. In your php.ini file increase memory_limit
  • unset() variables and cross your fingers. PHP runs its garbage collector as it sees fit and is difficult to gauge.
Mike B
+1  A: 

It looks like your server is configured with 32MB of memory allocated to PHP. Without knowing more about your app, that sounds like a reasonable amount, but there are certainly apps that require more.

In your php.ini file, you can increase the memory limit, like so:

memory_limit = 64M

Note that consistently increasing the amount of memory allocated to your application is often the sign of a bigger problem. You might also want a developer to look through the code for any data that is not being properly cleaned up.

jheddings
+1  A: 

Blah blah, memory_limit. Seems like everyone beat me to that one.

Take note, however, that the default memory limit for php is usually either 8 or 16mb, and you're using 32...Someone has already taken the step of increasing the limit for you, and with every increase, you're lowering the overall performance of your site...Higher limit means fewer instances, higher overhead, more possible errors.

I think you need to look into what it is that is eating up all this ram. Not to adopt a cliche, but 32mb should be enough for anyone, and if you just keep increasing the limit, you're going to paint yourself into a really ugly corner.

Satanicpuppy