One of my biggest frustrations with WordPress has been the amount of times that, at seemingly random times, I would get a completely blank screen.
Now a little research, and enabling debug messages, turned up that this was typically due to various plugins overloading the php memory limit.
The mighty google thre up a few solutions, none of which seemed to work:-
- increase the limit in php.ini – as I’m on a shared hosting platform this wasn’t editable (is that even a word?)
- override the limit per directory via .htaccess – which just resulted in the whole site throwing an internal server error (500)
- override the limit at run time via by adding [define(‘WP_MEMORY_LIMIT’, ‘128M’);] to wp-config.php – which seemed to make no difference
- override the limit per script by adding [ini_set(‘memory_limit’, ‘128M’);] to the relavent functions that are causing issues – again no dice
So I was almost at the point of raising a ticket with my hosting provider in the depressing anticipation of being told that increasing memory limits wasn’t an option on my bargin basement proce plan.
Then I had a though
Then I checked my research and spotted a tiny flaw….
All the articles I’d read were between 3 and 5 years – PHP had moved on quite a bit.
More research – some sleep – planting some sunflowers – and I found the answer
Since PHP 5.3 “.user.ini” can be used to override php.ini on a per directory basis – so in effect is the new .htaccess
Very simple – very straightforward and very workable….
http://kb.site5.com/php/how-to-make-custom-php-changes-using-a-user-ini-file/
Happy happy – now I can turn on all those lovely plugins that I had been skimping on