Trouble Shooting Wiki

Troubleshooting WordPress Installation

From TroubleshootingWiki

Jump to: navigation, search
WordPress
Official Page
Project Documentation
Download
Source Book
WordPress Complete
WordPress Complete
ISBN 978-1-904811-89-3
Publisher Packt Publishing
Author(s) Hasin Hayder

Contents

[edit] Troubleshooting during Installation

During installation, different problems may arise. If you are familiar with them, you may sort them quickly, without hunting around for solutions.

[edit] Problem: Headers Already Sent

Sometimes, when you point your browser to the blog, you may get an error that displays a headers already sent message on your page. The whole page may look scrambled and it will not function.

WordPress uses PHP session functions. If anything is displayed before these session functions, which may even be a blank space, then the session functions will not work properly because your browser has already received all headers and it starts displaying the output. In such circumstances, this error may occur.

You have to figure out where the error has occurred. Most of the time, it is a file that you have edited manually. If you remember, you edited the wp-config.php file while installing WordPress. Open the file with your text editor and make sure that there is nothing before the <? at the first line and after the ?> at the last line. Now save this file, upload it to your WordPress directory, and refresh your page again.

[edit] Problem: Page Comes with Only PHP Code

This could only happen when your server cannot parse PHP properly. This is a problem of your server configuration; either PHP is not installed on your server or it is not configured to function properly. To solve this problem, contact the system administrator for your server or try installing PHP.

[edit] Problem: Cannot Connect MySQL Database

If WordPress cannot connect to the MySQL database, it shows a page like the following screen:

To solve this problem, open your wp-config.php file and check whether the database parameters are correct. If you are sure that these settings are fine, please check if the MySQL daemon/service is running properly. If MySQL is not running, run this service. If MySQL was running, try restarting the service.

In MySQL version 4.1 and later, password encryption settings have been changed a bit, so PHP cannot connect to some versions of MySQL. If you are sure that your database parameters are fine and MySQL is also running, then connect to MySQL using your MySQL command-line tool and apply these commands:

 set password = OLD_PASSWORD('your_current_password');
 flush privileges;

This will use old encryption of passwords so that PHP can connect to MySQL. For example, let's assume my current database password is root with new encryption settings. I want to change it to old encryption settings. The following screenshot illustrates this:

[edit] Basic Troubleshooting

The best place where you can find help for WordPress is its own help system, http://codex.wordpress.org/Troubleshooting. No other site is comparable with it. Following are some basic and common problems that you may face while using WordPress.

[edit] Problem: Cannot See Posts, All It Says is Search Doesn't Meet Criteria

This could happen because of caching. For example, you have searched once and WordPress stored the search result inside its cache. So every time you visit the page you see the old result. You can solve this problem by clearing the cache and cookies from your browser. For this problem, you may also check search.php and index.php for errors.

[edit] Problem: I Want to Make My Blog Totally Private

If you are running your blog for a personal and private group or for your own official department so that only members of your group can see it, then you would want to secure it with some kind of authentication. WordPress has no built-in facility to do it. All you have to do is modify your .htaccess file to enable basic HTTP authentication. For that, you have to create the htpasswd file using the htpasswd command in Linux. If you are using Windows, then search in Google for htpasswd.exe and download it from a reliable location.

Let's create the htpasswd file by applying the following command in your command line:

htpasswd -cm .htpasswd myusername

This htpasswd command is a command-line tool available in all Linux distributions by default. Immediately after applying this command, the command-line tool will prompt you for a password; type your password. Please note that an htpasswd file containing the encrypted password has been created in the current working

directory for user 'username'. Copy that file to your WordPress folder. The htpasswd file itself is of no use, until you tell Apache what to do with it. So let us create a .htaccess file in your WordPress folder with the following content, which will tell Apache to turn on basic HTTP authentication using that htpasswd file:

 AuthType Basic
 AuthName "Restricted Area"
 AuthUserFile "absolute_url_of_your_.htpasswd_file"
 require valid-user

Save this file inside your WordPress directory as .htaccess. Now whenever you browse this WordPress URL using your browser, it requires the username and password that you created previously. You must supply the absolute URL of the htpasswd file in the .htaccess file; it will not work with a relative URL. For example, if your WordPress folder is located inside the /home/youraccount/public_html/wordpress folder, then the location of the .htpasswd file should be /home/youraccount/public_html/wordpress/.htpasswd.

If you have trouble retrieving this absolute path, then please don't worry. Create a PHP file inside this WordPress folder with the following code:

<? phpinfo(); ?>

Now run this file. You will see a page with a lot of text. Search for the text _SERVER["DOCUMENT_ROOT"], and you will find the absolute URL of this folder on the right-hand side of it. See the following screenshot:

[edit] Problem: I Don't Receive The Emailed Passwords

This problem may happen if your web server has no SMTP server installed, or if the mail function is explicitly disabled. Please contact your system administrator or try installing sendmail (or any other mail server) properly. It should work.

[edit] Problem: I Am Getting A Lot of Comment Spam

You have already got an idea how people can misuse some very useful features of a blog engine, like trackbacks and comments, for advertising purposes and spamming.So all you have to do is start fi ghting with spams. No doubt, it's very tough to make some automated programs or routines that can detect something as spam because spams don't always fall into a specifi c category. Moreover, spammers are also clever.

They are using new techniques, patterns, and styles for spamming. So it's really tough to automate the process of anti-spamming. How ever, all you can do is help the inner anti-spam procedure of WordPress by providing some specific keywords that are generally marked as spam. If you supply these words to WordPress, comments will be marked as spam when they contain any of these words. You have two choices; you can either delete these spams automatically or hold them in the moderation queue for manual checkup.

Let us learn how you can supply these words for WordPress. Go to the Options menu and then the discussion sub-menu.

Firstly, you will see a section titled Comment Moderation. In this section, you can insert suspicious words. If any of these words is found in a comment, WordPress will hold it in the moderation queue, even if you turn on public commenting. There is also another marker to suspect a comment as spam. A comment spam always contains a link, sometimes more than one. In the comment moderation section, there is a box that also detects a comment as spam if a comment contains more than 2 hyperlinks. You can set this number to any valid number. For example, you can queue all comments that contain even one hyperlink.

Further down, there is another section titled Comment Blacklist. If you insert some words and WordPress fi nds any of those words in any comment, then WordPress will delete that comm ent immediately. Those comments will not be queued even for moderation. So be sure before inserting any words here. Partial words can match here. For example, if you indicate blackjack as a blacklisted word and insert only black in the comment, then all comments containing the word black (black is a common word and there may be many non-spam comments with this word) will be deleted. Moreover, if the word black is part of a word like "blackbox", it will also get deleted. So always be sure before inserting a word in this box.

There is also a checkbox Blacklist comments from open and insecure proxies at the lower portion in this page. Comment spams are relayed by open proxies to avoid IP bans. WordPress has an internal list of these open proxies. So if you turn this checkbox on, it will delete any comment made from those blacklisted proxies as well.

You can get a lot of help from the following URLs. Moreover, you have the huge user community of WordPress to help you. So always use the support forum and Codex.

[edit] Additional References

  • For instructions on Configuring WordPress Themes, click here
  • For instructions on installing and setting up WordPress, click here

[edit] Source

The source of this content is Chapter 10:Administrator's Reference of WordPress Complete by Hasin Hayder (Packt Publishing, 2006).