server error, can not connect site,some time

Hi There,

Some time can not connect site, show server error.

The PHP error log

WordPress database error Unknown column 'wp_posts.post_type' in 'where clause' for query SELECT * FROM wp_comments JOIN wp_posts as cpm_p ON cpm_p.ID = wp_comments.comment_post_ID WHERE ( comment_approved = '0' OR comment_approved = '1' ) AND comment_post_ID = 595 AND cpm_p.post_type NOT IN('project', 'task_list', 'task', 'milestone', 'message') AND wp_posts.post_type NOT IN ('shop_order') ORDER BY comment_date_gmt DESC made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/blogs-mu/index.php'), locate_template, load_template, require_once('/themes/blogs-mu/index-post.php'), comments_popup_link, comments_number, get_comments_number, apply_filters('get_comments_number'), call_user_func_array, comment_count, get_comments, WP_Comment_Query->query

How to fix it?
Thanks

    Vinod Dalvi

    Hi @hi999

    I think the support access is revoked.

    Could you please grant me it again or can you send me your admin credentials please?
    - Send an email using our secure contact form on https://premium.wpmudev.org/contact/
    - Select "I have a different question" from the dropdown
    - On the subject enter "Attn: Vinod Dalvi".
    - Include the URL of this post in your message so that I may track this issue better
    - Include a link to your website
    - Include your admin credentials (username + password)

    Best Regards,
    Vinod Dalvi

    Vinod Dalvi

    Hi @hi999,

    Thank you for sending me site details and granting me support access.

    After sending me site details please update so on this thread so that it will be tracked in my thread feed.

    I checked the links you have sent me on the email but i didn't receive any error. ( See the attached screenshot )

    Could you please share me the screenshots where you are getting the errors?

    Also can you please try enabling WP_DEBUG mode and debug logging? To do this, just go to wp-config.php include this:

    define('WP_DEBUG',true);
    define('WP_DEBUG_LOG',true);

    You might already have a line for WP_DEBUG, so just make sure it's set to true. This will create a log file under wp-content/debug.log with detailed information.

    If you'd like to avoid end users seeing error messages, you can include this as well:

    @ini_set('display_errors',0);
    define('WP_DEBUG_DISPLAY', false);

    This will prevent errors from being displayed, but you can still find them in the log file. For information on this, checkout this wpmu.org article.

    Let me know what errors if any you are getting on visiting those pages where you are having problems!

    Regards,
    Vinod Dalvi

    hi999

    Hi Vinod

    Thank you for support.
    The site still have same problem.
    When I click the menu always have

    "Server error"

    web page not come out, until refresh, some time the web page come out.

    Is my SQL data full?

    I have PHP error log plugin, can I use your code

    If you'd like to avoid end users seeing error messages, you can include this as well:

    @ini_set('display_errors',0);
    define('WP_DEBUG_DISPLAY', false);
    This will prevent errors from being displayed, but you can still find them in the log file.

    Please see PHP error log

    Thanks!
    -----------------------

    Mar 12, 10:47:12	 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 523800 bytes) in /wp-includes/wp-db.php on line 1478
    Mar 12, 10:47:12	 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 523800 bytes) in /wp-includes/option.php on line 1905
    Mar 12, 10:47:12	 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 88 bytes) in /wp-content/plugins/events-and-bookings/events-and-bookings.php on line 1534
    Mar 12, 10:47:58	 WordPress database error Unknown column 'wp_posts.post_type' in 'where clause' for query SELECT * FROM wp_comments JOIN wp_posts as cpm_p ON cpm_p.ID = wp_comments.comment_post_ID WHERE ( comment_approved = '0' OR comment_approved = '1' ) AND comment_post_ID = 595 AND cpm_p.post_type NOT IN('project', 'task_list', 'task', 'milestone', 'message') AND wp_posts.post_type NOT IN ('shop_order') ORDER BY comment_date_gmt DESC made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/blogs-mu/index.php'), locate_template, load_template, require_once('/themes/blogs-mu/index-post.php'), comments_popup_link, get_comments_number, apply_filters('get_comments_number'), call_user_func_array, comment_count, get_comments, WP_Comment_Query->query
    Mar 12, 10:47:58	 WordPress database error Unknown column 'wp_posts.post_type' in 'where clause' for query SELECT * FROM wp_comments JOIN wp_posts as cpm_p ON cpm_p.ID = wp_comments.comment_post_ID WHERE ( comment_approved = '0' OR comment_approved = '1' ) AND comment_post_ID = 595 AND cpm_p.post_type NOT IN('project', 'task_list', 'task', 'milestone', 'message') AND wp_posts.post_type NOT IN ('shop_order') ORDER BY comment_date_gmt DESC made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/blogs-mu/index.php'), locate_template, load_template, require_once('/themes/blogs-mu/index-post.php'), comments_popup_link, comments_number, get_comments_number, apply_filters('get_comments_number'), call_user_func_array, comment_count, get_comments, WP_Comment_Query->query
    Mar 12, 10:47:58	 WordPress database error Unknown column 'wp_posts.post_type' in 'where clause' for query SELECT * FROM wp_comments JOIN wp_posts as cpm_p ON cpm_p.ID = wp_comments.comment_post_ID WHERE ( comment_approved = '0' OR comment_approved = '1' ) AND comment_post_ID = 1 AND cpm_p.post_type NOT IN('project', 'task_list', 'task', 'milestone', 'message') AND wp_posts.post_type NOT IN ('shop_order') ORDER BY comment_date_gmt DESC made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/blogs-mu/index.php'), locate_template, load_template, require_once('/themes/blogs-mu/index-post.php'), comments_popup_link, get_comments_number, apply_filters('get_comments_number'), call_user_func_array, comment_count, get_comments, WP_Comment_Query->query
    Mar 12, 10:47:58	 WordPress database error Unknown column 'wp_posts.post_type' in 'where clause' for query SELECT * FROM wp_comments JOIN wp_posts as cpm_p ON cpm_p.ID = wp_comments.comment_post_ID WHERE ( comment_approved = '0' OR comment_approved = '1' ) AND comment_post_ID = 1 AND cpm_p.post_type NOT IN('project', 'task_list', 'task', 'milestone', 'message') AND wp_posts.post_type NOT IN ('shop_order') ORDER BY comment_date_gmt DESC made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/blogs-mu/index.php'), locate_template, load_template, require_once('/themes/blogs-mu/index-post.php'), comments_popup_link, comments_number, get_comments_number, apply_filters('get_comments_number'), call_user_func_array, comment_count, get_comments, WP_Comment_Query->query
    Mar 12, 10:48:24	 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 147 bytes) in /wp-includes/plugin.php on line 193
    Mar 12, 10:48:24	 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 44003 bytes) in /wp-includes/functions.php on line 252
    Mar 12, 10:48:25	 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 97 bytes) in /wp-includes/plugin.php on line 193
    Mar 12, 10:48:26	 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 113 bytes) in /wp-includes/plugin.php on line 193
    Mar 12, 10:48:27	 WordPress database error Unknown column 'wp_posts.post_type' in 'where clause' for query SELECT * FROM wp_comments JOIN wp_posts as cpm_p ON cpm_p.ID = wp_comments.comment_post_ID WHERE ( comment_approved = '0' OR comment_approved = '1' ) AND comment_post_ID = 595 AND cpm_p.post_type NOT IN('project', 'task_list', 'task', 'milestone', 'message') AND wp_posts.post_type NOT IN ('shop_order') ORDER BY comment_date_gmt DESC made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/blogs-mu/index.php'), locate_template, load_template, require_once('/themes/blogs-mu/index-post.php'), comments_popup_link, get_comments_number, apply_filters('get_comments_number'), call_user_func_array, comment_count, get_comments, WP_Comment_Query->query
    Mar 12, 10:48:27	 WordPress database error Unknown column 'wp_posts.post_type' in 'where clause' for query SELECT * FROM wp_comments JOIN wp_posts as cpm_p ON cpm_p.ID = wp_comments.comment_post_ID WHERE ( comment_approved = '0' OR comment_approved = '1' ) AND comment_post_ID = 595 AND cpm_p.post_type NOT IN('project', 'task_list', 'task', 'milestone', 'message') AND wp_posts.post_type NOT IN ('shop_order') ORDER BY comment_date_gmt DESC made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/blogs-mu/index.php'), locate_template, load_template, require_once('/themes/blogs-mu/index-post.php'), comments_popup_link, comments_number, get_comments_number, apply_filters('get_comments_number'), call_user_func_array, comment_count, get_comments, WP_Comment_Query->query
    Mar 12, 10:48:27	 WordPress database error Unknown column 'wp_posts.post_type' in 'where clause' for query SELECT * FROM wp_comments JOIN wp_posts as cpm_p ON cpm_p.ID = wp_comments.comment_post_ID WHERE ( comment_approved = '0' OR comment_approved = '1' ) AND comment_post_ID = 1 AND cpm_p.post_type NOT IN('project', 'task_list', 'task', 'milestone', 'message') AND wp_posts.post_type NOT IN ('shop_order') ORDER BY comment_date_gmt DESC made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/blogs-mu/index.php'), locate_template, load_template, require_once('/themes/blogs-mu/index-post.php'), comments_popup_link, get_comments_number, apply_filters('get_comments_number'), call_user_func_array, comment_count, get_comments, WP_Comment_Query->query
    Mar 12, 10:48:27	 WordPress database error Unknown column 'wp_posts.post_type' in 'where clause' for query SELECT * FROM wp_comments JOIN wp_posts as cpm_p ON cpm_p.ID = wp_comments.comment_post_ID WHERE ( comment_approved = '0' OR comment_approved = '1' ) AND comment_post_ID = 1 AND cpm_p.post_type NOT IN('project', 'task_list', 'task', 'milestone', 'message') AND wp_posts.post_type NOT IN ('shop_order') ORDER BY comment_date_gmt DESC made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/blogs-mu/index.php'), locate_template, load_template, require_once('/themes/blogs-mu/index-post.php'), comments_popup_link, comments_number, get_comments_number, apply_filters('get_comments_number'), call_user_func_array, comment_count, get_comments, WP_Comment_Query->query
    Mar 12, 10:49:27	 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 41635 bytes) in /wp-includes/functions.php on line 252
    Mar 12, 10:49:27	 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 116 bytes) in /wp-includes/plugin.php on line 193
    Mar 12, 10:49:35	 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 17976 bytes) in /wp-includes/functions.php on line 252
    Mar 12, 10:49:39	 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 17976 bytes) in /wp-includes/functions.php on line 252
    Mar 12, 10:49:51	 WordPress database error Unknown column 'wp_posts.post_type' in 'where clause' for query SELECT * FROM wp_comments JOIN wp_posts as cpm_p ON cpm_p.ID = wp_comments.comment_post_ID WHERE ( comment_approved = '0' OR comment_approved = '1' ) AND cpm_p.post_type NOT IN('project', 'task_list', 'task', 'milestone', 'message') AND wp_posts.post_type NOT IN ('shop_order') ORDER BY comment_date_gmt DESC LIMIT 25 made by wp_dashboard, do_meta_boxes, call_user_func, wp_dashboard_site_activity, wp_dashboard_recent_comments, get_comments, WP_Comment_Query->query
    Log file: /php-errors.log (6.92 MiB) Clear Log
    Vinod Dalvi

    Hi @hi999,

    Thank you for your detailed reply.

    It seems from the error message that it is raised because of lack of memory allocated to PHP on your server.

    Could you please try Increasing memory allocated to PHP using the information provided on the following page?

    http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP
    http://docs.woothemes.com/document/increasing-the-wordpress-memory-limit/

    Regards,
    Vinod Dalvi

    Vinod Dalvi

    Hi @hi999,

    I contact godaddy, they told me

    In cPanel > PHP Configuration > it shows that you have : memory_limit set to 256M

    Then it means either any plugin / theme is taking a lot of resources for execution or your database is too big to query resulting in taking a lot of resources.

    You can just try on your development site deactivating all other plugins and using default WordPress theme like Twenty Twelve as displayed in the flowchart on the following page to know which theme / plugin is taking a lot of resources if any.

    https://premium.wpmudev.org/manuals/getting-support/

    Also check the size of your database.

    Regards,
    Vinod Dalvi

    Vinod Dalvi

    Hi @hi999,

    How to check the size of database

    You can check it as described on the following pages.

    http://www.mkyong.com/mysql/how-to-calculate-the-mysql-database-size/
    http://docs.cpanel.net/twiki/bin/view/AllDocumentation/CpanelDocs/MySQLDatabases#The Current Databases Table

    Alternatively you can use any of the following plugins.

    https://wordpress.org/plugins/db-size/
    http://wordpress.org/plugins/wp-memory-db-indicator/

    Regards,
    Vinod Dalvi

    hi999

    Hi Vinod,

    Thank you for nice help.
    I have upgrade hosting from 4GB RAM to 8GB RAM and
    In cPanel > PHP Configuration > it shows that have : memory_limit set to 256M

    but the site still very slow and some the page not show up.

    Please go to my main site have PHP error log, still have memory problem.

    Could you kindly log my site and WHM see how to fix it.

    Thans!

    Mar 21, 04:54:15 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 117 bytes) in /wp-includes/plugin.php on line 193
    Mar 21, 04:54:17 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 120 bytes) in /wp-includes/plugin.php on line 193
    Mar 21, 04:54:17 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 131 bytes) in /wp-includes/plugin.php on line 193
    Mar 21, 04:54:22 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 49443 bytes) in /wp-includes/functions.php on line 252
    Mar 21, 04:55:45 WordPress database error Table 'wp24hws_24hws.wp_3525_wp_pro_quiz_master' doesn't exist for query SELECT * FROM wp_3525_wp_pro_quiz_master made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, SFWD_LMS->add_post_types, LD_QuizPro->get_quiz_list, WpProQuiz_Model_QuizMapper->fetchAll

    Mar 21, 04:55:47 WordPress database error Table 'wp24hws_24hws.wp_3525_wp_pro_quiz_master' doesn't exist for query SELECT * FROM wp_3525_wp_pro_quiz_master made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, SFWD_LMS->add_post_types, LD_QuizPro->get_quiz_list, WpProQuiz_Model_QuizMapper->fetchAll

    Vinod Dalvi

    Hi @hi999,

    Have you calculated your database size?

    If the database is too big then you should consider deleting unused data from it.

    You should also test whether there is any plugin / theme which is taking a lot of resources for execution by deactivating all other plugins and using default WordPress theme like Twenty Twelve on your development site as displayed in the flowchart on the following page.

    https://premium.wpmudev.org/manuals/getting-support/

    Regards,
    Vinod Dalvi

    Vinod Dalvi

    Hi @hi999,

    Your database size is large so you should optimize your database.

    You can try optimizing it using the following plugins and by implementing the instructions provided on the following pages.

    https://premium.wpmudev.org/blog/wordpress-maintenance-101-how-to-optimize-and-repair-database-tables/
    http://wordpress.org/plugins/rvg-optimize-database/
    https://wordpress.org/plugins/wp-optimize/
    http://www.wpexplorer.com/optimize-wordpress-database/

    Can I set the Multi-DB with my hosting plan.?

    Can I set to – use 256 databases (50,000 – 100,000 blogs/sites )

    Can I upgrade to – use 4096 databases (100,000+ blogs/sites ) later?

    Yes you can you will find more information about it on the following page.

    https://premium.wpmudev.org/project/multi-db/#usage

    Cheers,
    Vinod Dalvi