Possible causes and solutions for "Allowed memory size of" error (PHP memory overflow)
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:
Images within articles are excessively large, exceeding the memory_limit. Solution: Compress images.
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.
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).
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.
Article link: https://docs.zbp.cool/themedocs/26.html
Helpful?
2025-10-10 13:47:31