Fatal Error

10 posts by 2 authors in: Forums > CMS Builder
Last Post: April 1, 2014   (RSS)

By wevolutions - March 31, 2014

I upgraded my version of cmsAdmin and I am getting this error message on this page below. Any assistance will be appreciated. Thank you.


Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 80 bytes) in /home/tcfs/public_html/cmsAdmin/lib/upload_functions.php on line 43

By wevolutions - March 31, 2014

Here is the response from my server admins:

We regret to hear you're experiencing issues with the script at [ http://www.trinicarsforsale.com/database/featured_section.php ]. We created a custom PHP.ini in the home directory for this user, where a memory limit can be set. This was increased all the way of to 1024mb, but there was no change in the error. Unfortunately it is unclear as to what is consuming so much memory - we would recommend reviewing the PHP scripts referenced in the memory allocation error.

By Chris - March 31, 2014


Can you upload the source code of that page as an attachment? We can have a look to see what might be wrong.

All the best,

By wevolutions - March 31, 2014

Everything was working great until I did an upgrade to my cmsAdmin yesterday.

By Chris - March 31, 2014

Hi arifkhayam,

I don't see anything wrong with your page.

Could you please fill out a second level support request with your FTP information so we can take a closer look?



All the best,

By wevolutions - March 31, 2014

Thank you. Support request sent.

By Chris - March 31, 2014 - edited: March 31, 2014

Hi arifkhayam,

Thanks for the FTP details — I was able to check a couple of things out and I've fixed that page. 12,325 is a lot of records! Since the logic in your FOREACH (regarding featuredStartDate, featuredEndDate, and the current time) currently ignores all but 30 of those records, moving that filtering condition into your WHERE clause yields massive improvements. I changed the 'where' line in your getRecords() call near the top of the script and it seems to work much better now!

Here's what it was:

'where' => 'featured_ad = 1',

And here's what it is now:

'where' => 'featured_ad = 1 AND featuredStartDate < NOW() AND NOW() < featuredEndDate',

The IF condition is now redundant, but I left it in there in case you need to reference it for any reason.

Hope this helps!

All the best,

By wevolutions - April 1, 2014

Thank you Chris for sorting this out for me. I have one other page which has basically the same function with the start and end date. Do you think I should edit the code on that page using the same format as shown before?

Here is the page:


Here is the relevant code:

list($featured_carsRecords, $featured_carsMetaData) = getRecords(array(
'tableName' => 'featured_cars',
'where' => 'premium_ad = 1',
'orderBy' => 'RAND()',
'allowSearch' => '0',

By Chris - April 1, 2014

Yes, absolutely. Just make the same change to the 'where' line as above.

The more filtering you can do on the database side, the faster your page will be and the less memory it will use.

All the best,