Wp-Config.Php Error Reporting

How to Fix the Blank White Screen Error in WordPress

WordPress is an incredible system when it comes to developing websites. However, it’s not invulnerable to its own type of problems. Although it’s not a common issue, sometimes you may be faced with the white screen of death.

In this instance, WordPress will display a blank white screen. There will be no error messages, no hint as to what the issue is and no way to tell for certainty how to fix it.

In this tutorial, we’ll share some of the most common things that cause this white screen of death and how you can go about fixing the error.

Why Does This Error Happen?

A blank screen in WordPress can be caused by a myriad of things. It can show up on an admin page while the rest of the website works perfectly. You may even experience a blank screen on one post while the others are flawless.

In most instances, the blank white screen is caused by an exhausted memory limit for WordPress. Having too many plugins running simultaneously or a faulty plugin could be taking up the memory. Resources usage can cause issues, and a bad plugin can tap the components used for your site.

Themes can also be a cause of the blank screen. Improper coding is often the culprit in this instance, which is why you should always research themes you use from untrusted sources.

Unfortunately, troubleshooting this kind of a problem could take a great deal of time. There is simply too much that can be wrong for any one solution to be completely accurate.

Here are some of the most common and easy fixes to try before you start delving into some of the more deeper issues.

Fix 1: Clear Your Cache

One of the easiest ways to solve the white screen of death in WordPress is by emptying your cache. If you can access the admin panel but the front end of the site is displaying a blank screen, you may have to empty the cache used by certain tools. This problem is often caused by a caching plugin and can be quickly fixed from the admin panel.

Fix 2: Checking Other Site Issues

If you have more than one instance of WordPress running on a server, find out if the other sites are having the same issue. This can help you eliminate many possibilities. For instance, a problem on one WordPress site and not the others can lead to:

  • Faulty plugins
  • Bad themes
  • Custom coding issues
  • Compromised files from hacks or malware

If the white screen is displayed on all of your sites, then there is more than likely a problem with the server itself. In which case, you will need to contact your web host provider or network administrator.

Fix 3: Checking the Memory Limit

Exhausting the memory can cause a white screen to appear. Sometimes it may be accompanied by a message that the memory size has been exhausted. In this case, you may need to increase your limit in WordPress.

Step 1: Using a FTP application like FileZilla, access your WordPress root folder.

Step 2: Save a backup copy of your wp-config.php file. It’s always safer to make sure you have backups of files such as these before you consider editing them.

Step 3: Inside the main php tag of the file, insert the following code:

Step 4: This increases the memory limit to 64mb for WordPress.

Step 5: Save the file to the WordPress root folder.

If the blank white screen persists, then the memory wasn’t the problem and it’s time to check the plugins.

Fix 4: Disabling Plugins

The wrong plugins can cause all kinds of issues on a website. While many developers try to make everything compatible, sometimes these additions break each other or have the slightest error in the code. As a result, the site can break down.

There are a number of ways you can deactivate plugins, and it also depends on whether you have access to the admin panel of WordPress. Here are a few methods to deactivate plugins.

Admin Panel

The easiest method is to just log into the admin panel, go to the plugins section and deactivate them all. Then, you can turn them back on one-by-one until you come across the one causing the issue.

Delete Through FTP

If you’re unable to access the admin panel, you can delete plugins by using FTP. Go to the root folder of your website, access wp-content and open the plugins folder, you can delete those files directly. Afterward, you should be able to access your website. That is, if it was a plugin causing the issue.

Fix 5: Changing the Theme

Sometimes a bad theme can lead to a white screen of death in WordPress, especially if it’s coded incorrectly. At which point, you will need to remove the theme or change it. You can do this easily from the admin panel if you have access to it. Otherwise, it may be much easier by using FTP.

Deleting Your Theme

One of the easiest ways to eliminate the theme if you’re unable to access the WordPress admin panel is by deleting it. To do this, access the root folder of your WordPress website. Access the wp-content subdirectory and go into the themes folder. Create a copy of this folder just in case you need it later.

Find your theme and delete it. WordPress will automatically fall back on its default theme the next time someone accesses the website.

Fix 6: WordPress in Debug Mode

You can change the blank screen in WordPress to show you errors which may help you fix the problem. This is done by accessing the wp-config.php file in your root folder.

Create a backup of the wp-config.php file. Using an editor, add the following code to the file and save it to the site:

error_reporting(E_ALL); ini_set(‘display_errors’, 1);
define( ‘WP_DEBUG’, true);

When you access the website again, this time the blank screen will list the errors in the system. By tracking down these errors, you may find even more solutions to the problem.

Fix 7: Recovery from a Backup Copy

It’s always a good practice to keep current backups of your WordPress website. This can be done through a myriad of plugins or by using FTP to copy your entire website.

If you come across a blank screen, simply recover your site from the backup by copying the files back to your web host. Although you may be missing recent changes to the site, at least you’ll be back to a running platform.

Fix 8: Reinstalling WordPress

If there is a core file that is causing the issue, it may be prudent to reinstall WordPress. This can be done through cPanel by accessing “Quick Install.” Remove the installation and then reinstall a fresh copy of WordPress.

Use this option only if you’ve exhausted every other alternative. This will get rid of any custom content and settings in one fell swoop.

For the most part, WordPress is a stable tool as a content management system, or CMS. However, there are simply too many people who contribute to the development of plugins, themes and core files that sometimes things can go awry. Not everything works as flawlessly as we would like.

What kind of errors have you come across in WordPress? If you use an FTP program, which one do you use?

Themeforest hosting dangerous WordPress theme code

I’ve been having problems with setting the upload permissions for wordpress recently. It seems that the main thing is to make sure the upload directory is owned by the web server account. In the case of apache this is “www-data”.

For Linux/Ubuntu you can use the following commands to set the correct ownership and directory permissions:
chown -R www-data:www-data /var/www/wordpress/wp-content/uploads
chmod -R 755 /var/www/wordpress/wp-content/uploads

WordPress multisite with rewrite to root subdirectory

How to set up a WordPress multi-site with a single sub-directory from the root url ( http://www.mysite.co.nz/another_wordpress_blog). Please note that “another_wordpress_blog” is a not the first site of the multi-site.

In the httpd.conf file set the rewrite rule like:

In the database change the following tables like so:

table wp_2_options

field: siteurl – /another_wordpress_blog/

field: home – /another_wordpress_blog/

table wp_blogs

field: path ( where blog_id is 2) – /another_wordpress_blog/

You may also run into an error (concerning cookies) when logging in to the sub-site. In that case add the following to wp-config.php:

// cookie error madness on login fix.
define(‘ADMIN_COOKIE_PATH’, ‘/’);
define(‘COOKIE_DOMAIN’, ”);
define(‘COOKIEPATH’, ”);
define(‘SITECOOKIEPATH’, ”);

WordPress 3.8 – Warning: Missing argument 2 for wpdb::prepare()

WordPress 3.8 not backward compatible?

upgraded wordpress to 3.8 and started getting this error on a custom search
Warning: Missing argument 2 for wpdb::prepare()

The function now needs two variables such that $wpdb->prepare($sql) needs to be replaced with $wpdb->prepare($sql, $args). In my case I just left the $args as blank ($wpdb->prepare($sql, ”)), and that fixed the warning.

It’s also possible to ignore the warning altogether by adding:
error_reporting(0);
@ini_set(‘display_errors’, 0);

Editing your WordPress wp-config.php File

The wp-config.php file contained in the root of your WordPress install directory contains all the configuration items for connecting and interacting with WordPress. The most important information it contains is the credentials for connecting to the MySQL database which without this you’d just see an white page with an error message saying “Database Not Found. Let’s look at editing your wp-config.php file so see how we can customize WordPress to suit your needs.

Editing your WordPress wp-config File

Choose your favorite text editor to accomplish this, I like Notepad++ . Take care when editing your wp-config.php file because entering the wrong data can break your site.

Take care when editing your wp-config.php file

Installing WordPress on Localhost – XAMPP

Installing WordPress on your computer can be a great step towards building a testing environment for your WordPress themes and plugins. WordPress can be installed both on Mac and Windows and upon successful installation it runs just like the live site. The beauty of installing WordPress on your localhost is that you can carry out a variety of tests without worrying that things will go wrong. I will be illustrating how to install WordPress on one of the most common desktop servers – Xampp. For you to follow this tutorial you need to download and install Xampp.

Installing WordPress on Localhost Xampp

Before we get started with WordPress installation, you need to have Xampp running on your computer. You can download Xampp from here, installation of Xampp is easy since should click on the .exe file and allow it to run.

You should follow the installation prompts like installation procedure of any other software or.exe files. It also important to note that Xampp utilizes the same port 80 and 443 as Skype and at times there is a conflict between the two.

You can solve this conflict by editing the Skype ports or editing Xampp settings to use different ports instead of port 80 and 443. When you create the new ports for Xampp your localhost address will have to change to include the ports.

Example; if you have the new port as 80, your localhost address will be;
http://localhost:80 or http://127.0.0.1:80
If you want to run Xampp server without editing the ports on Skype or Xampp you can run one at a time. This means you can switch off Skype in order to run Apache sever. Detailed Installation of Xampp is beyond the scope of this tutorial.

Installing WordPress on Xampp

Step 1: Start, Test Xampp Server and Create Site Folder

The first step when installing WordPress is to start your Xampp server, ensure you start Apache and MySQL. Click on the start button to start running Apache server and MySQL database.

After starting the server we need to check from the browser if everything is running on well. To check we should type on the browser localhost or 127.0.0.1. If the server is up and running well you should see the following screen:

The second step is to create site folder inside htdocs folder. In Xampp server the site lives in a folder named htdocs;

We will name our site Demo so we need to create the folder inside htdocs and name it ‘Demo’ then check on the browser to see if the folder is visible.

We now check on the browser to see where we will be installing WordPress.

Step 2: Download WordPress and Extra into the Site Folder

Download WordPress and extra it in the folder we created inside the htdocs folder. To download WordPress official site and click on the .zip download file to begin downloading WordPress.

After downloading WordPress we should now extract it to our Demo folder and test it on the browser to see if it’s ready for installation.

After extracting WordPress to the Demo folder we need to copy all the files to from the WordPress folder to the Demo folder. After extracting and copying the file your demo folder should look like this;

Now we should test the site on the browser to see if WordPress is ready for installation. If you have followed all the steps correctly, you should now see the WordPress setup page as shown below;

Step 3: Create WordPress Database

WordPress runs on MySQL database and we need to begin by creating the database before we start running WordPress installation. It’s important you understand that the database we are creating will be linked to WordPress in a file called wp-config.php. We will therefore require the following database details to setup WordPress successfully;

Database name – this is the name of the actual database

Database username – this is the name of database user with Global Privileges

Database password – this is the password of the database

Database host – this is the host of our site, in this case it is the localhost

To create the WordPress database we need to open Phpmyadmin and create the database, create a user then assign the user Global Privileges. To open Phpmyadmin we need to type on the browser;
http://127.0.0.1/phpmyadmin or http://localhost/phpmyadmin

Click on the databases to begin creating the WordPress database and you should now fill out the name of your database and click create button;

After creating the database we need to create a user and allow the user to have all the privileges. To create the user first select the database you created then navigate to privileges on the top menu, under privileges click on add new user. After clicking on add user, you should now type in the database login details that include the name of the user, host and the password of the database.

At this stage you should remember the host should remain as localhost. This also applies when you create a database on hosting since localhost means within the same environment.

After creating the database user we now need to give the user all the privileges. Under the login details form there is a section of allocating Global Privileges to the user. We need to check all and click on go to allocate all the privileges to the user we created.

Step 4: WordPress Installation

Now we need to go back to our WordPress setup and begin the installation since we now have the database details. Click on let’s go button and fill the name of the database, name of the database user and the password of the database as we had set up in Phpmyadmin console.

When you click on submit you should now see the screen that shows your database details are right and you can now run the WordPress installation. Click on run installation to begin the process of installing WordPress on your local Xampp server.

Now fill the site’s details that include the site’s name, WordPress admin username, admin password, admin email and whether you should discourage the search engines from indexing the site.

After filling these details you should click on install WordPress and complete by logging in to test if your WordPress installation is successful.

If you have followed all the steps correctly, you should see the screen showing you have successfully installed WordPress on your Xampp server.

Step 5: Test Your Installation and Check the wp-config.php file

After filling the details above and clicking on install WordPress, you should now be ready you login and test your new WordPress installation as well as review the wp-config.php file to see what is in there.

Let’s now login and see how our site looks like:

As you can see above we have successfully installed WordPress and login and everything works well. If we navigate to our htdocs folder then to the site’s folder – demo we can open and see the wp-config.php file.

This is a very important file since it is what links the WordPress application phase to the MySQL database. When you open this file you will see the following code:
// ** MySQL settings – ** //

/** The name of the database for WordPress */

/** MySQL database username */

/** MySQL database password */

/** Database Charset to use in creating database tables. */

/** The Database Collate type. Don’t change this if in doubt. */

define(‘DB_COLLATE’, ”);
If you carefully look at this code, it details the database we created in Phpmyadmin, the username, the password and the host. These details are very important for any WordPress installation. As you will see in manual WordPress installation, these details are filled to connect WordPress to the database that exists in the server.

If you would like this WordPress installation to serve as your development environment there is a small edit we need to carry out in the wp-config.php file to allow for error reporting.

By default when you install WordPress on your localhost the debugging mode will be turned off. You need to look for this line of code in wp-config.php and change the Boolean value to TRUE.

You should edit it to look as shown below;
define(‘WP_DEBUG’, true);
Conclusion

We have successfully, installed WordPress on localhost Xampp server

In the next tutorial, I will be installing WordPress on Wamp Server another popular desktop server. I hope this tutorial has guided you and enlightened you on how to install WordPress on localhost. If you have any questions, comments, compliments or further inquiries please get in touch using the comments section below.

Leave a Reply

Your email address will not be published. Required fields are marked *