Prevent PHP running out of memory