Xampp error Fatal error: Allowed memory size of 134217728 bytes? How can i fix this?

Hello all. I tend to write my own content management systems for practice in xampp. For some reason it stopped loading this afternoon. I do not know what went wrong.

I am currently getting an error that says: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 35255167 bytes) in Unknown on line 0

How can I fix this? I tried googling but I could find nothing xampp specific.

Thanks in advance.

I would recommend you avoid doing this on a live host, (make your code more efficient instead) but as long as it’s your localhost you could try throwing more memory at it. eg.

<?php 
ini_set('memory_limit', '512M'); // 4x default 
//ini_set('memory_limit', -1); // no limit 
⋮

The error says your script has consumed all available server RAM.
You can increase limit as Mittineague said, but I would find what causes this in your code.
I guess you have forever loop somewhere so script never ends

I think that would be more likely to throw a timeout, but I agree, the optimal approach is to pinpoint the problem.

It may help if you unset() any large variables as soon as you are done with them.

Have you changed any code recently? if you have, does that code involve any looping?

I meant the phpmyadmin section of the xampp, so I suspect my code doesn’t play a role in there. I got the error on the login page and then after I logged in as well. However I turned it on this morning and it was gone.

I had a new error that said #2006 mysql server gone away when I tried inserting data. This I corrected by increasing the max_allowed_packet from 1m to 10m.

Not sure what is happening but it is working now.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.