What the white screen of death means: Difference between revisions From Online Manual

Jump to: navigation, search
mNo edit summary
No edit summary
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Source of the Problem==
{{TOC right}}
The issue appears to be that when a page is loaded, and the script tries to load one (or more) additional files to perform sub-tasks, the system runs out of allocated memory.
==What is the White Screen of Death==
A white screen when opening a page in SMF (or in any other PHP-based application) means that an irrecoverable error occurred, which caused the execution of the script to be halted before any content is outputted to your browser.


This happens most often on a shared host on an "oversold" siteYour host does not explicitly limit the memory, bandwidth, or disk space you can use.  But once your shared server starts to get full, those resources will have to be shared by a number of "unlimited" accountsAt this point, the host will have to apply "hidden" limits to the accounts to keep the accounts from overloading the server.  You will start running into memory, disk space, or bandwidth problems, or even have your forum shut down -- temporarily or permanently. Even though you are, therefore, meant to have been offered an "unlimited" service, you have not.
There are ''mainly'' two reasons for this to happenThe first is that there is a PHP error in the code of your forum (which you might get if you are performing changes in the code or installing a MOD)The second is that PHP cannot use the necessary memory for the task being requested.


It is important to realize that there is a limit to how much memory a given script can access, and that every host has to have limits like this. The difference is that some hosts let you know in advance what your limits are going to be, and will be able to discuss how you can get more resources if you need them. An oversold host cannot do this, because the limits are variable.  The limits are related to how many accounts they place on the same server, how much disk, memory, CPU or bandwidth those accounts use.
===Why Do I See a White Page and Not the Error Itself?===
Your PHP configuration may prevent this error from being displayed. On a live and fully functional web site your guests are not supposed to see errors (if they occur), because they might reveal file paths or other sensitive information. For this reason, some hosts specifically configure PHP to not show errors.


In some cases, the host has set this limit very low.  So low, in fact, that the package manager cannot load Subs-Post.php to process the BBC tags in the readme file of a mod.  If that step is skipped, the script chokes when it tries to load Subs-Package.php, to actually do the install.  Processing stops before the package can be checked or installed, and the HTML document does not get created correctly.
==How to Get More Information==
There are several ways to obtain more information. Some of these are listed below, but please be aware that they might not exist in your specific server configuration.


==How to Solve the Problem==
===Contact your Host===
 
Assuming you do not run your own server, contacting your host is the easiest way to obtain information. Your host should have access to all your logs, so they should be able to provide you with detailed information.
You now have three choices:
 
# Ask your host to increase your available memory.
# Switch to a non-overselling host. There are a large number of those hosts listed in our [http://www.simplemachines.org/community/index.php?board=4.0/ Hosts and Hosting] boards
# See below for options that you ''can'' try (none are guaranteed to work) if you want to stay on your current host.
 
These hosts may be slightly more expensive than the one that you originally chose, but, as is often the case, you do get what you pay for.
 
===Increase memory allocation externally===
You can try and use a .htaccess file to overwrite the memory limit, but if the server controls it (which is probably the case, since SMF tries to set it high enough using '''ini_set''' when installing a mod package), than it probably won't work, and you are stuck with the server php memory limit. 
Using  phpinfo() should also tell you if PHP runs in CGI mode or as an Apache module (mod_php).  If CGI mode htaccess won't work, if Apache module, use htaccess to set the php memory limit:
 
*Creating a [[Phpinfo() - What's that, then|phpinfo.php file]], will tell you your php memory limit.
{{code|1=<nowiki><?php phpinfo(); ?></nowiki>}}
 
*In .htaccess, you can try to add the following:
{{code|1=<nowiki>php_value memory_limit 64M</nowiki>}}
 
*If you add this and get a 500 Internal Server Error, then your host is running PHP in CGI Mode, and you will have to increase the memory_limit in the php.ini file.
{{code|1=<nowiki>memory_limit = 64M</nowiki>}}
If you are not allowed to have a custom php.ini file, you will have to ask your host to do this.


===Increase memory allocation in the file(s)===
===Check your Logs===
You can try to increase the memory allocation in the files and functions, directly.
When a PHP error occurs, it is logged in a file in your server's hard drive. Depending on your configuration, you should also have that file in your home directory. Use your FTP client and search for a file which is usually called "error_log", "error.log", or variations of this.  If you do not find such file, that is because your server is not configured to create it. Contact your host and ask them to enable this option, as it is a very helpful debug tool.


*In /Sources/Class-Package.php, find:
===Try to Output More Information===
It is possible to tell PHP to output the error information directly to your browser. To do so, edit SMF's index.php (make sure that you create a backup first) with your favourite text editor and find:
{{code|1=<nowiki>
{{code|1=<nowiki>
// If we're using this try to get some more memory.
// Get everything started up...
@ini_set('memory_limit', '32M');
define('SMF', 1);
</nowiki>}}
</nowiki>}}
*Replace with
 
Replace with:
{{code|1=<nowiki>
{{code|1=<nowiki>
// If we're using this try to get some more memory.
error_reporting(E_ALL);
@ini_set('memory_limit', '128M');
ini_set('display_errors', 1);
 
// Get everything started up...
define('SMF', 1);
</nowiki>}}
</nowiki>}}
After you fix the underlying problem you should revert this change.
==How to Solve the Problem==
How to solve the problem depends specifically on what the problem is. The most common causes are:


*in /Sources/Admin.php, find
===PHP Code Errors===
{{code|1=<nowiki>
You should only see these errors when you are editing your forum's code or when installing/uninstalling MODs. Your log should display something like (these are just examples):
// Get one of the admin information files from Simple Machines.
{{code|1=<nowiki>Parse error: syntax error, unexpected $end in /home/user/public_html/forum/index.php on line 175</nowiki>}}
function DisplayAdminFile()
{{code|1=<nowiki>Fatal error: Call to undefined function getInitialInformation() in /home/user/public_html/forum/index.php on line 175</nowiki>}}
{
''(error, file name, file path and and line number might of course vary)''
global $context, $modSettings, $smcFunc;


@ini_set('memory_limit', '32M');
===PHP Memory Errors===
</nowiki>}}
This error occurs when the code execution tries to allocate more memory than the system is configured to grant. Your log should tell you something like:
*Replace with
{{code|1=<nowiki>Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 826064718 bytes) in /home/user/public_html/forum/index.php on line 175</nowiki>}}
{{code|1=<nowiki>
''(memory quantities, file name, file path and and line number might of course vary)''
// Get one of the admin information files from Simple Machines.
function DisplayAdminFile()
{
global $context, $modSettings, $smcFunc;


@ini_set('memory_limit', '128M');
==Ask us for Support==
</nowiki>}}
Please ask us for support by posting in [http://www.simplemachines.org/community/index.php#c3 the appropriate support board] for the version of SMF your forum uses. Please make sure you provide us with your [http://wiki.simplemachines.org/smf/What_is_a_phpinfo%28%29_file phpinfo] alongside your request.


[[Category:FAQ]]
[[Category:FAQ]]

Latest revision as of 12:28, 17 June 2016

What is the White Screen of Death

A white screen when opening a page in SMF (or in any other PHP-based application) means that an irrecoverable error occurred, which caused the execution of the script to be halted before any content is outputted to your browser.

There are mainly two reasons for this to happen. The first is that there is a PHP error in the code of your forum (which you might get if you are performing changes in the code or installing a MOD). The second is that PHP cannot use the necessary memory for the task being requested.

Why Do I See a White Page and Not the Error Itself?

Your PHP configuration may prevent this error from being displayed. On a live and fully functional web site your guests are not supposed to see errors (if they occur), because they might reveal file paths or other sensitive information. For this reason, some hosts specifically configure PHP to not show errors.

How to Get More Information

There are several ways to obtain more information. Some of these are listed below, but please be aware that they might not exist in your specific server configuration.

Contact your Host

Assuming you do not run your own server, contacting your host is the easiest way to obtain information. Your host should have access to all your logs, so they should be able to provide you with detailed information.

Check your Logs

When a PHP error occurs, it is logged in a file in your server's hard drive. Depending on your configuration, you should also have that file in your home directory. Use your FTP client and search for a file which is usually called "error_log", "error.log", or variations of this. If you do not find such file, that is because your server is not configured to create it. Contact your host and ask them to enable this option, as it is a very helpful debug tool.

Try to Output More Information

It is possible to tell PHP to output the error information directly to your browser. To do so, edit SMF's index.php (make sure that you create a backup first) with your favourite text editor and find:


// Get everything started up...
define('SMF', 1);

Replace with:


error_reporting(E_ALL);
ini_set('display_errors', 1);

// Get everything started up...
define('SMF', 1);

After you fix the underlying problem you should revert this change.

How to Solve the Problem

How to solve the problem depends specifically on what the problem is. The most common causes are:

PHP Code Errors

You should only see these errors when you are editing your forum's code or when installing/uninstalling MODs. Your log should display something like (these are just examples):

Parse error: syntax error, unexpected $end in /home/user/public_html/forum/index.php on line 175
Fatal error: Call to undefined function getInitialInformation() in /home/user/public_html/forum/index.php on line 175

(error, file name, file path and and line number might of course vary)

PHP Memory Errors

This error occurs when the code execution tries to allocate more memory than the system is configured to grant. Your log should tell you something like:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 826064718 bytes) in /home/user/public_html/forum/index.php on line 175

(memory quantities, file name, file path and and line number might of course vary)

Ask us for Support

Please ask us for support by posting in the appropriate support board for the version of SMF your forum uses. Please make sure you provide us with your phpinfo alongside your request.



Advertisement: