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

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.

It is showing 128M

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:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.