wordpress Blank page after posting a comment (wp-comment-post.php)

  • If you try to back up your database, you’ll be thrown with this error message – wp_comments is marked as crashed and should be repaired when using LOCK TABLES
  • Recent comments widget appears blank.
  • Top commenter widget appears blank.
  • Comment posted will not be written into DB, therefore will not be shown.
  • Comments section in WP Admin appears to have zero records.

After searching the Internet high and low in hoping to find similar cases to help me identify and fix the problem, I end up with nothing. I found this solution finally on hongkiat website. Thanx a ton to him. Below is the cause and solution to the problem. Plz Leave Comment If you Like the post…

The fix / Solution
Tables can sometimes get cluttered with little bits of info that are not actually needed, and while they don’t break (unless they get really overcrowded) it is sometimes wise to tidy them up. For some reason this is called “Repairing”
To fix this, you must have access to the wordpress database, either via PhpMyAdmin or Secure Shell (SSH). Most shared hosting account comes with phpMyAdmin, but either option you should be extremely careful because you dealing with the database. Any wrong move will cause more data lost.
1. Login to phpmyadmin.

A list of your databases will appear. Click the one that is your WordPress database.

image

2. Click ‘databases’

3. Tick the check box against the table wp_comments

image

4. Scroll all the way down and look for ‘With selected‘ drop-down box. Select Repair table and things should be alright.

phpmyadmin-fix.gif

Now you have repaired your table and your comment should work fine now.

Plz do Leave Comment If your problem is solved… If not follow instructions below…

In case your storage engine does not support repair table then go through following steps:

Before going further ahead, Please take a backup of your database. Beacause you may loose all the comments posted till now on your blog.

After following first two steps from above procedure,

3. Click on SQL on top of Table List

image

4. You will get the window similar to this6

image

5. On the text window type following query and click on ‘go’ button.

DROP TABLE IF EXISTS `wp_comments`;
CREATE TABLE `wp_comments` (
  `comment_ID` bigint(20) unsigned NOT NULL auto_increment,
  `comment_post_ID` int(11) NOT NULL default '0',
  `comment_author` tinytext NOT NULL,
  `comment_author_email` varchar(100) NOT NULL default '',
  `comment_author_url` varchar(200) NOT NULL default '',
  `comment_author_IP` varchar(100) NOT NULL default '',
  `comment_date` datetime NOT NULL default '0000-00-00 00:00:00',
  `comment_date_gmt` datetime NOT NULL default '0000-00-00 00:00:00',
  `comment_content` text NOT NULL,
  `comment_karma` int(11) NOT NULL default '0',
  `comment_approved` varchar(20) NOT NULL default '1',
  `comment_agent` varchar(255) NOT NULL default '',
  `comment_type` varchar(20) NOT NULL default '',
  `comment_parent` bigint(20) NOT NULL default '0',
  `user_id` bigint(20) NOT NULL default '0',
  PRIMARY KEY  (`comment_ID`),
  KEY `comment_approved` (`comment_approved`),
  KEY `comment_post_ID` (`comment_post_ID`),
  KEY `comment_approved_date_gmt` (`comment_approved`,`comment_date_gmt`),
  KEY `comment_date_gmt` (`comment_date_gmt`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
 

6. You will receive message that the query was successful.

Your comments should be working fine now.

If this does not work for you, try this: (thanks to Matthew Ogston for this)

When publishing a new comment, users receives a 404. Problem is that comments DB table for some reason stops auto-incrementing itself.

Just change the ‘comment_ID’ id column to Auto Increment and it should work okay. New comments will be saving correctly after this.

If nothing works for you, then backup everything and then do a fresh install for your wordpress. This should solve all your problems.

Plz Leave Comment If you Like the post…

Related Posts :

39 Comments to “wordpress Blank page after posting a comment (wp-comment-post.php)”

  • Robin Wills@ tanie rozmowy telefoniczne September 6, 2009 at 4:44 am

    Very nice and usefull information I have a good blog but need to take it to the next level. Thanks for this… though I feel a little overwhelmed about the work I still need to do to make it extra optimized.

  • Camping Children September 7, 2009 at 5:52 pm

    Excellent! I have been looking for a solution for this now for quite awhile with no luck. The problem seems to be all over the place, but the solutions are just not there, at least for me. This was the only thing that finally worked!

  • saurabh didwania September 9, 2009 at 10:19 am

    @camping children..
    I am glad that you finally found the solution..
    If you like my blog please spread the word, you can also comment or suggest anything about this site…

  • Todd Gross September 18, 2009 at 8:01 pm

    I really appreciate this post. My blog has been showing blank pages for over a month now, and everything I tried failed, but this repair table thing has worked, and I sure appreciate you putting it here for us to find.

  • jyoti September 21, 2009 at 12:10 pm

    i try above but not get solution .
    p-comments-post.php not display.
    http://www.seekvacationrentals.com/wp-comments-post.php

  • saurabh didwania September 21, 2009 at 1:23 pm

    Hi jyoti,
    I would be glad to help u out, if u can explain what problem u r facing.
    I tried to visit your site, but its asking for password…

    Also, have u tried dropping the comment table and recreating it?

  • jyoti September 21, 2009 at 6:19 pm

    thank you
    when i drop my comment table its solved. because my comment table is currupted . so my new problam is how to recover data from currepted sql data.

  • saurabh didwania September 22, 2009 at 10:31 am

    @ Jyoti

    Once you drop the table you can not recover the data coz all data is deleted with the table..
    you have to take backup before dropping the table..
    Only for this reason I have First asked to repair the table. Dropping the table is last option as some hosting server does not support repairing the tables..
    I’ll soon post an article on how to take backup of database for wordpress..

  • saurabh didwania September 22, 2009 at 10:47 am

    @ Christopher Damba

    I suggest you to upgrade your wordpress to version 2.8.4a
    because this is a bug in 2.7 and has been resolved in 2.8
    Don’t forget to backup your database before upgrading..

    this link will help you..
    http://codex.wordpress.org/Upgrading_WPMU

  • jyoti September 22, 2009 at 2:52 pm

    i have taken backup. but backup sql is currupeted. and no repaire working proper.

  • saurabh didwania September 22, 2009 at 5:28 pm

    @ Jyoti
    Plz tell me your backup file format, then I’ll be able to find a solution for it.
    Apparently the problem with this database is the entry of two same primary key in the comment table
    All primary key in a table should be unique….
    so if we can delete one of the duplicate entry from table, that will solve the problem

  • Christopher Damba September 24, 2009 at 1:38 pm

    @saurabh I upgraded to version 2.8.4a but still getting a blank wp-comments-post.php page after entering comments in a preview post (http://drivelive.cdsm3.co.uk/wordpressmu/?p=113&preview=true). I’ve also tried repairing the comments table wp_1_comments but still the bug reappears.

  • saurabh didwania September 24, 2009 at 6:35 pm

    @ Christopher Damba
    I think this is not a bug. when you preview a post, the particular post is not present in the database, so when you post a comment in the preview, wp-comment-post.php could not find the post in the database and thus show a blank page.
    And by the way, only administrator can see a preview, you should not worry about this thing because nobody post a comment in the preview.
    any other query, I would be glad to help… :-)

  • Cristian Nistor September 29, 2009 at 12:41 pm

    The SQL query creates a little issue. The ‘comment-approved’ field has more than one index. So, KEY `comment_approved` (`comment_approved`) it’s a little bit useless.

    Regards

  • Shauna @ BreathingProsperity.com October 9, 2009 at 6:11 am

    Wooohooooo!!!!!!!!!!!

    Saurabh, you are a GENIUS! This is such a simple fix (at least for me) and I’ve been googling and on WP forums for two days trying to fix it. Thank you SO much!

    Shauna

  • saurabh didwania October 9, 2009 at 12:23 pm

    @Shauna
    I m glad you found the solution.. please suggest this link to ppl who are facing this problem… :-)

  • Matt October 10, 2009 at 7:23 pm

    Shouldn’t you include a warning before step 5 to backup their database or at least the contents of that table? You are instructing your readers to destroy all of the comments people have made on their blog. You should warn them this is what they are doing. Not everyone knows what an SQL DROP statement does.

  • saurabh didwania October 11, 2009 at 1:58 am

    You are right Matt, I have modified the post and included a warning…
    Thanx for the suggestion…. :-)

  • Allison October 15, 2009 at 4:28 am

    I am still getting the blank page when someone leaves a comment. I have followed your instructions. :-/

  • Catrina October 21, 2009 at 3:17 am

    Hello, I’ve tried the first solution and it didn’t work. Then, I tried the second solution with the SQL and it didn’t work even after it said the query was completed succesfully. What could be problem? My blog is http://blog.catrinaiscoolbeans.com. I’ve tested it and I’m still getting the blank page.

  • saurabh didwania October 22, 2009 at 11:52 am

    @ Catrina,

    I have tried posting a comment in your blog and its working fine. Can you please tell me in detail, what problem u r facing?

  • saurabh didwania October 22, 2009 at 11:58 am

    @ Allison
    If your blog is wellreadreviews.com, then your comments are working fine, i have posted a comment there..

  • Allison October 22, 2009 at 3:58 pm

    That is because I backed everything up and did a fresh install with new databases.

  • Dennis October 23, 2009 at 6:35 pm

    I really appreciate this post!!!
    I am glad that someone finally found the solution…
    Thank you very much saurabh

  • Jane October 27, 2009 at 4:44 am

    I did the repair and optimization earlier and have the same problem.

    On your Step 5, it asks: “Do you really want to :
    DROP TABLE IF EXISTS `wp_comments`;
    CREATE TABLE `wp_comments` (
    `comment_ID` bigint(20) unsigned
    …”

    This gets me nervous!

    The page I’m having a problem on is http://www.dogsdontlookbothways.com/joeys_blog/2999-dog-hit-by-car-broken-jaw-leg-pelvis/

    I also have the page go blank when I change the default user email address in “users and authors” of the admin (me) to the actual email address. When I change it back to you@yourdomain.com, the page shows correctly again.

    Jane

  • Christopher Damba October 29, 2009 at 8:47 pm

    Thank you so much Saurabh for the clarification. Much appreciated!

  • Matt Chiste November 1, 2009 at 3:12 am

    awesome! You guys currently have the same problem with your blog that I was having on mine – if I tried to submit with my version of IE (i’m posting this with FF), I’d get a blank page at “http://www.princeblog.net/wp-comments-post.php#comment-”. Why? Because of a bug in the error handling for the user-agent header. Here’s what I originally wrote (but couldn’t post here with my version of IE):

    I had this same problem with IE.

    I ran some diagnostics and inserted some print statements in the wp_insert_comment (comment.php).

    Basically, my problem was the USER AGENT header; in my version of IE it was “Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; Trident/4.0; EmbeddedWB 14.52 from: http://www.bsalsa.com/ EmbeddedWB 14.52; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; MS-RTC LM 8; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; .NET CLR 3.0.30729)”

    That’s 282 characters. Why’s that important? Because the wp_comments table has a comment_agent field with a length of only 255 characters.

    The fix? Run this against your wp_comments table:
    ALTER TABLE `wp`.`wp_comments` MODIFY COLUMN `comment_agent` VARCHAR(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

    Hope this helps!

  • Omer Rosenbaum November 11, 2009 at 6:30 pm

    Hej saurabh didwania
    Same problem here, but with all actions I do upon my blog. For example, when I try to preview a post while writing it I get referred to here: http://sundsvallexpress.se/wp-admin/post.php
    Try to leave a comment and you will get a similar thing. I can´t also logout.

    It looks like the problem is in my DB, but I tried your solution with wp_comments and it didn´t work.

    PLZ PLZ PLZ help…

  • Omer Rosenbaum November 11, 2009 at 7:05 pm

    it looks like one of the plugins is causing that problem. I changed the theme and turned off the plugins and the problem disappeared.
    Now I am trying to rule out which plugin it was and see how to fix that.

  • Priyanka April 22, 2010 at 7:05 pm

    Hi Saurabh, I have the same issue with wp-comment-post- I am using php-cgi lines in the files, this is a fresh install of 2.9.2 and so I am using the default theme and no plugins. When I am logged in as an admin I can post the comments, but when someone else tries to comment, the error message displayed is 500. However, when I go back to the post and refresh I see that the comment is posted. So I think it is the redirect(after commenting) to the post is not happening. What could be going wrong, please suggest. I have tried to empty DB(as it was a fresh install) and even tried to reinstall; but nothing helps. Any help would be greatly appreciated.

    Thanks very much.

    Priyanka

  • Kamal Hasa April 30, 2010 at 9:32 pm

    All I did was replace the php file with a new one. Problem solved !

  • Shaka May 8, 2010 at 1:27 am

    Thank you huge!. I upgraded wp to 2.9 and searched high and low for the blank page comment solution and nothing worked until this. The repair table didnt do anything I had to run the sql command ubove then it worked.

  • R May 10, 2010 at 1:25 am

    FYI, that “repair table” action breaks Wordpress’ new threaded-comment functionality.

  • Matthew Ogston May 17, 2010 at 10:34 pm

    Hi everyone- had a very similar problem…when publishing a new comment users were receiving a 404. Looked at the comments DB table and for some reason it had stopped auto-incrementing itself.

    I changed the ‘comment_ID’ id column to Auto Increment and it seems to work okay now. New comments are saving correctly.

  • Merchant Capital May 19, 2010 at 11:41 am

    Thanks for such a nice info..

  • MaD May 23, 2010 at 2:48 pm

    Nope. It doesn’t work. I’m gonna cry now :’(

  • Saurabh Didwania June 7, 2010 at 1:32 am

    Hi Priyanka,

    Sorry, couldn’t reply earlier. I hope your problem is solved by now, but if not then here is my suggestion.
    For your blog it seems as the problem is with the theme or one of the php files. Try replacing your comments.php with original file. This should solve you problem.

    Let me know the results..

  • casio July 22, 2010 at 2:30 pm

    Wow ! thank you.

  • mattes July 22, 2010 at 6:32 pm

    nice site

Post comment

daily email newsletter

Enter your email address:

Video of The Day

Random Articles

Popular Posts This Month

Recent Posts

Crazy Blogroll