phpmysqlpearmdb2

Fatal error memory owing to being exhausted at runtime


Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 51 bytes) in C:\xampp\htdocs\project\App\library\PEAR\MDB2\Driver\mysql.php on line 1160

I have a large DB (1.5GB) and I come up with that error when I am trying to search through the DB for information. I have no idea how to resolve that ? Thank you if anyone could be of help. :-)


Solution

  • Appart from some crazy loops that you could be performing on your code the most straightforward reason you can be getting that error is if you are completely neglecting the usage of the database and trying to load it all up into PHP.

    But that would be crazy! :)

    If your database of choice is SQL based try something like:

    SELECT *
    (...)  
    LIMIT 20 // to get the first xx results only
    

    As a side note, it's great that you are learning with a large database as the majority of novice errors (like non indexing tables and things alike will be instantly evident).