- b2evolution CMS User Manual
- Operations Reference
- Troubleshooting
- When I do X I get a blank page or only a half page
When I do X I get a blank page or only a half page
Short answer:
- 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
blogs/conf/_advanced.php
: - Edit your php.ini file (ask your hosting provider if you don’t know what this is) and increase the value of memory_limit, for example:
- Sometimes, the server setup allows you to override the original php.ini setting by adding a new php.ini in the root or somewhere on the server.
- Add this to
.htaccess
:
PHP
// 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' ); |
Code
memory_limit = 128M |
Code
# 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:
Code
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.
Solutions:
- 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:
- As a last resort, you can manually change the default max_execution_time in php.ini as explained above but this is suboptimal since it will apply to all pages, including those that should execute in less than 5 seconds unless something goes wrong, and if something goes that wrong, it’s a good thing that PHP will stop after 30 seconds.
Code
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.
Created by fplanque • Last edit by fplanque on Jul 24, 2013