0

I am getting:
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 79 bytes) in /path/dbclass.php on line 225

line 225  :  $row   =   mysql_fetch_assoc($res);  
  1. It was 64M; increased to 128M but no luck.
  2. I added ini_set('memory_limit', '-1'); at top of the page but no luck.
  3. I added the php_value memory_limit 512M in the htaccess but no luck. Site went down; got fatal error.

    Options +FollowSymlinks
    RewriteEngine on

    RewriteBase /prolinc/

    RewriteBase /

    RewriteCond %{HTTP_HOST} ^domainname.com$ [NC]
    RewriteRule ^(.*)$ http://www.domainname.com/$1 [L,R=301]

    php_value memory_limit 512M

Edited by Abhi_6

2
Contributors
3
Replies
35
Views
2 Years
Discussion Span
Last Post by cereal
0

Hi,

check if the new value was applied by using ini_get():

echo ini_get('memory_limit');

some hostings does not allow to change the core directives.

0

Ok,

then it can be the result set, that is buffered into PHP and that hits the limit. You can limit the query, but if you are retrieving blob data or large chunk of text even in small data sets you don't solve.

By default, MySQL queries are buffered, but you can avoid this behaviour. You should switch to PDO or MySQLi as the MySQL API is deprecated and now removed from PHP 7.*

But, anyway, instead of mysql_query() try mysql_unbuffered_query() as explained here:

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.