-2

I have recently installed a theme on WordPress and when activated it merely results in a blank white screen. What are the possible causes of this? and the steps in which to take to start finding the issue.

The problem revealed itself when moving the site from our test server to the hosting company's sever, which we have used to host various other WordPress sites. What are the likely causes of white screen in my instance? and the steps in which to take to start finding the issue. I have took steps following research such as increasing memory limit and disabling plugins etc but they worked fine on the original server so I doubt it can be caused by plugins etc.

Thank you

UPDATE

Right, so far, I have increased the memory limit to 128M, and disabled all plugins as well as temporarily naming their folders.

I have enabled to debugging thanks to the suggestion by @Sabari, this has resulted in the following error: Fatal error: Call to undefined function mb_internal_encoding() in /home/neatly/public_html/wp-content/themes/best_wedding_dress-babe23c7e828662f1a07c296a5608f52/functions.php on line 12

I am less than useless with PHP but you could make some suggestions on how to proceed that would be excellent such as where and how to define mb_internal_encoding. Here is the code on line 12:

mb_internal_encoding(get_bloginfo('charset'));

I would like to reiterate that this worked perfectly on our test server and all these issues only developed when moved to a new server. I have transferred WordPress sites from one server to another many times and have re-downloaded and uploaded both the content and database three times on this specific website. Both versions (test server and new server) have the same versions of WordPress so it could be possibly that the new server has different technology. Is there anything along these lines that could be causing this error?

Answer suggested by Sabari

The issue was solved by enabling and configuring mbstring (multibyte support) on our webhost's server.

Paul
  • 257
  • 2
  • 4
  • 14
  • possible duplicate of [Reference - What does this error mean in PHP?](http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – deceze Apr 09 '13 at 07:03
  • 1
    enable debug mode in config and see what causes the blank screen. define('WP_DEBUG', true); – Sabari Apr 09 '13 at 07:05
  • 1
    @DonCallisto Yeah, possibly but while delivering this message he asked me to tell you that your grammar is HORRENDOUS. Thanks for your lack of help :) – Paul Apr 09 '13 at 07:07
  • @PaulArmstrong: Read stack overflow FAQ before ask something. Thank you. – DonCallisto Apr 09 '13 at 07:13
  • 1
    @DonCallisto I've just give it a look and I do not see the issue. Is it because this seems not to be a specific problem? It is actually a specific problem, although I did not state this. I thought for sheer simplicity would be better as to provoke simple, quick and easy responses as the FAQ section suggests I should. – Paul Apr 09 '13 at 07:18

3 Answers3

2
WSOD. OK... possible cause, theme exhausts the memory limit
a) clear you cache
b) Make a backup before changing anything
c) Disable the plugins,  
d) Replace Theme with a Default Theme
e) Re-install Wordpress

use debugging for troubleshooting

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

In Wordpress:

define( 'WP_DEBUG', true);
Nik Drosakis
  • 2,258
  • 21
  • 30
  • Hi, I've done this, increased memory limit to 128m, disabled all plugins and swapped my theme to the default TwentyTwelve theme and it works. However, the theme I developed still does not. – Paul Apr 09 '13 at 07:21
  • 1
    @PaulArmstrong What is the error you see when you enable debug in wp-config.php – Sabari Apr 09 '13 at 07:40
  • @Sabari Fatal error: Call to undefined function mb_internal_encoding() in /home/neatly/public_html/wp-content/themes/best_wedding_dress-babe23c7e828662f1a07c296a5608f52/functions.php on line 12. – Paul Apr 09 '13 at 07:42
  • @Sabari Line 12: mb_internal_encoding(get_bloginfo('charset')); See my updated question as its laid out better. – Paul Apr 09 '13 at 07:43
2

I think your issue is regarding with mbstring extension not enabled.

mb_internal_encoding function requires mbstring extension . It is a non-default extension, that is not enabled by default.

You can see this for more info on how to install and configure mb_string http://www.php.net/mbstring.

If you are on windows then uncomment the line (remove semicolon before extension=php_mbstring.dll) extension=php_mbstring.dll; in php.ini.

If you are on linux you could try yum install php-mbstring for centos.

For ubuntu I am not clear.

Restart apache after this.

UPDATE :

To check if extension is enabeled you can use :

if (extension_loaded('mbstring')) {
    //functions using mb string extensions
}

NEW UPDATE :

if (extension_loaded('mbstring')) {
    mb_internal_encoding(get_bloginfo('charset'));
}

I think WordPress has a built in function wp_set_internal_encoding() which will handle these. You just need to call this function in your file. What wp_set_internal_encoding() does is the same thing I explained above :

function wp_set_internal_encoding() {
    if ( function_exists( 'mb_internal_encoding' ) ) {
        if ( !@mb_internal_encoding( get_option( 'blog_charset' ) ) )
            mb_internal_encoding( 'UTF-8' );
    }
}

It checks whether the mb_internal_encoding function exists (the function will only exist if the extension is loaded). This is another way to check if the function exists.

The advantage will be that you have to call only the function and don't worry about the other things. WordPress will handle those .

NEW UPDATE :

For your first error, wrap your mb_strlen function inside the function_exists () like :

if ( function_exists( 'mb_strlen' ) ) {
    mb_strlen();
 }

May be if you have the extension enabled and it may have been corrupted. So it is better to check if the function exists before calling that .

For your second error, you don't need to add the wp_set_internal_encoding in your functions.php or any other file. It is a WordPress inbuilt function. You just need to call the function wp_set_internal_encoding. You are actually declaring the function which exists. So PHP will return fatal error.

NEW UPDATE

In your function you have mb_strlen which will work only mbstring extension is enabled. So you should change

function theme_trim_long_str($str, $len = 50, $sep = ' '){
    $words = split($sep, $str);
    $wcount = count($words);
    while( $wcount > 0 && mb_strlen(join($sep, array_slice($words, 0, $wcount))) > $len)     $wcount--;
    if ($wcount != count($words)) {
        $str = join($sep, array_slice($words, 0, $wcount)) . '…';
    }
    return $str;
}

to

function theme_trim_long_str($str, $len = 50, $sep = ' '){
    $words = split($sep, $str);
    $wcount = count($words);

    if ( function_exists( 'mb_strlen' ) ) {
        while( $wcount > 0 && mb_strlen(join($sep, array_slice($words, 0, $wcount))) > $len)     
            $wcount--;
    } else {
        while( $wcount > 0 && strlen(join($sep, array_slice($words, 0, $wcount))) > $len)
            $wcount--;
    }
    if ($wcount != count($words)) {
        $str = join($sep, array_slice($words, 0, $wcount)) . '…';
    }
    return $str;
} 

Hope this helps you :)

Sabari
  • 6,205
  • 1
  • 27
  • 36
  • Hi there, yeah I agree with what your suggesting. However, (I should of stated this earlier) the CMS and theme worked perfectly with no errors on our test server and only produced this problem now that we have moved the site to the hosting company's server. Most themes from the WordPress library work, there is a couple that do not. I have moved many WordPress sites in the past and have re-downloaded and re-uploaded the content and database to this specific site three times without change. Does this help at all? – Paul Apr 09 '13 at 07:50
  • 1
    @PaulArmstrong The test server would have this extension enabled. But now you have moved to a new production server. Then you have to enable the required extensions. May be you can contact your hosting providers for the same. – Sabari Apr 09 '13 at 07:55
  • Thanks, is there anyway of testing that this is a problem at their end before I call. A way to check whether or not these extensions are enabled? – Paul Apr 09 '13 at 07:58
  • 1
    @PaulArmstrong Check my update of how to check if extension is enabled or not – Sabari Apr 09 '13 at 08:00
  • forgive my ignorance and sheer stupidity, but where do I put this? and how do I run it? Do I simply activate the theme once this is in place? – Paul Apr 09 '13 at 08:09
  • 1
    @PaulArmstrong You should wrap your mbstring functions inside that extension_loaded condition. Please check my new update – Sabari Apr 09 '13 at 08:26
  • Im afraid that merely swapped one set of problems for another. Please see my updated questions as it was too long to post here. However, I am still none the wiser to whether or not 'mbstring' is enabled or not. – Paul Apr 09 '13 at 08:52
  • I am not sure to be honest. I did not want to waste anymore of your time without speaking to the webhost and making sure mbstring is enabled which I am fairly sure will solve the problem but I will certainly get back to you to letting you know how I get on and dish out some upvotes your way. – Paul Apr 09 '13 at 10:19
  • 1
    @PaulArmstrong No Problem. Let me know when you solve the issue. So by the time what is the output of extension_loaded('mbstring'). It will tell you whether the extension is enabled or not. Also you can echo phpinfo(); on some page to see which all extensions are loaded – Sabari Apr 09 '13 at 10:22
  • Like I said before where do I paste that code? if (extension_loaded('mbstring')) { mb_internal_encoding(get_bloginfo('charset')); } and then how to I execute it? I apologise but this is my first real intro to PHP today. – Paul Apr 09 '13 at 10:26
  • What I did was take your first IF statement and replaced the code that was throwing the error (mb_internal_encoding(get_bloginfo('charset'));) and paste your code over it which produced error1 (see question). But I doubt this was what you wanted me to do with the code. – Paul Apr 09 '13 at 10:29
  • 1
    @PaulArmstrong I want you to replace this mb_internal_encoding(get_bloginfo('charset')); with this if (extension_loaded('mbstring')) { mb_internal_encoding(get_bloginfo('charset')); } or this if ( function_exists( 'mb_internal_encoding' ) ) { mb_internal_encoding(get_bloginfo('charset')); } . But then I saw that there is an internal wordpress function wp_set_internal_encoding (). So just replace mb_internal_encoding(get_bloginfo('charset')); with wp_set_internal_encoding (); – Sabari Apr 09 '13 at 10:32
  • Right, so when I do that the white screen situation is gone and the theme appears but with no menus or content and displays error1 (see question). So then I add your last bit of code to the misc.php just above line 21 (where it reports the problem) and nothing changes. I will update line 21 (problem) to my question. – Paul Apr 09 '13 at 10:38
  • 1
    @PaulArmstrong line 21 should be changed to if ( function_exists( 'mb_strlen' ) ) { mb_strlen(); }. We need to check whether that function exist or not – Sabari Apr 09 '13 at 10:40
  • right, so I replaced the entire function and line 21 separately and both resulted in the following error: Fatal error: Call to undefined function theme_trim_long_str() in /home/neatly/public_html/wp-content/themes/best_wedding_dress-babe23c7e828662f1a07c296a5608f52/library/navigation.php on line 271. – Paul Apr 09 '13 at 10:47
  • Patience of a saint ha, implemented and received the following error: Fatal error: Call to undefined function mb_strlen() in /home/neatly/public_html/wp-content/themes/best_wedding_dress-babe23c7e828662f1a07c296a5608f52/library/misc.php on line 11. Line 11 is the return part: function theme_is_empty_html($str){ return (!is_string($str) || mb_strlen(str_replace(array(' ', ' ', "\n", "\r", "\t"), '', $str)) == 0); } – Paul Apr 09 '13 at 10:53
  • 1
    @PaulArmstrong You are using mb_strlen at many places. That is why it is retuning fatal error. You need to change or add the checking at all postions. It will be better you enable the extension else it will be a hard work for you – Sabari Apr 09 '13 at 10:56
  • mbstring = enabled, configured settings and it works like a dream. Thank you for your suggestions, your time, your expertise and your patience. Legend in my book! – Paul Apr 09 '13 at 11:55
  • 1
    @PaulArmstrong Cool. Let me know if you run in to any issues – Sabari Apr 09 '13 at 12:14
1

Many things can happen. If files are not uploaded properly, then it may happen. If the theme has any error with function file, also then it may happen.