When I do X I get a blank page or only a half page
- your PHP is out of memory
- or your PHP is out of allowed execution time
- or your .php file cannot be read by Apache
Giving PHP more memory
There are several possible ways to fix this (hopefully one of them will work for you):
- Uninstall some plugins to free up memory. If you cannot uninstall plugins because you get a blank page on uninstall, delete some plugins from the /plugins folder.
- Change this setting in
// If you get blank pages or missing thumbnail images, PHP may be crashing because it doesn't have enough memory. // The default is 8 MB (in PHP < 5.2) and 128 MB (in PHP > 5.2) // Try uncommmenting the following line: ini_set( 'memory_limit', '128M' );
memory_limit = 128M
# Increase memory limit php_value memory_limit 128M
Giving PHP more execution time
The execution time is limited in php.ini by the following directive:
max_execution_time = 30 ; Maximum execution time of each script, in seconds
In this example, it means that any PHP script that runs past the 30 seconds limit will die, typically with no warning and no message on screen. This gives you half a page on the browser and the browser seems to be waiting for more, but more will never come.
You can try to change the value above, but most of the time, when b2evolution knows it needs to perform a long operation (like upgrade, DB maintenance or creating test/sample data for example), it will ask PHP to give it more time (by using PHP’s
set_time_limit() function call). Sometimes up to 3000 seconds instead of 30.
So your real problem is probably not the default max_execution_time but rather the fact that your PHP refuses to give more when asked for.
On b2evolution v5+, you can check this on your System Status page.
- One reason why b2evolution may not be able to request more time may be if your PHP is running in safe mode. Check that PHP is not running in safe mode.
- Another reason may be that the set_time_limit() function was disabled via the Suhosin Hardened PHP patch. Check if you’re using that patch and if you can change the configuration.
- Another reason may be that you have a php_admin directive in any of your Apache webserver configuration files which looks like this:
This means b2evolution won’t be able to request more than 30 seconds. If you have this line, comment it out or remove it.
php_admin_value max_execution_time "30"
Making sure your .php file can be read by Apache
In some occasions, if the webserver cannot read the php script it tries to read, it will just output a blank page without logging any error.
A good test is to create a file named
test.html next to your php file, give it the exact same File Permissions and try to access it through the web. If it doesn’t work, you know you have a file permissions problem.