Menu

Possible causes and solutions for "Allowed memory size of" error (PHP memory overflow)

This article was last updated 37 days ago, please note whether the content is still available

This method specifically targets memory exhaustion caused by thumbnail generation (indicated by "thumb.php" in debug mode).

Themes with an automatic thumbnail generation feature may encounter PHP memory exhaustion errors on the first page load because all thumbnails for that page are generated in bulk. This error is more common on collection sites with a large number of articles.

The error message typically looks like: Allowed memory size of 123456 bytes exhausted (tried to allocate 1234 bytes).

Solution

Open:

zb_system/function/lib/thumb.php

Find (around line 414):

imagefill($this->tmpRes, 0, 0, 0xffffff);

Change it to (comment out or delete):

//imagefill($this->tmpRes, 0, 0, 0xffffff);

Go back to the error page to see if it's resolved. If the problem persists, continue to the solutions below.

Previous Solutions

Possible causes of the error and solutions:

  1. Images within articles are excessively large, exceeding the memory_limit. Solution: Compress images.

  2. A large number of pinned articles leads to hundreds of articles being loaded and their thumbnails generated simultaneously on the list page. Solution: Unpin a large number of articles; you can re-pin them after thumbnail generation is complete.

  3. The PHP memory_limit is set too low. Solution: Modify the PHP configuration to increase the memory_limit (this is also the ultimate solution, as with sufficient memory, the previous two issues become non-issues).

  4. Another potentially effective solution: In the website settings, under page settings, reduce the "Number of articles to display on list pages." Browse through a few pages until thumbnail generation is complete, then change it back.


Helpful?

Comments(1)

剑影逍遥客
剑影逍遥客

2025-10-10 13:47:31

“本文详细解析了缩略图生成导致的PHP内存溢出问题及多种解决方案。”

Post comment

Support Live Chat
TOP