WordPress.org

Ready to get started?Download WordPress

Forums

WordPress database error Got a packet bigger than 'max_allowed_packet' (7 posts)

  1. Erfo
    Member
    Posted 3 years ago #

    Hi.
    In Error log of my site, I see lots of these errors "WordPress database error Got a packet bigger than 'max_allowed_packet'".
    Now, in the .htaccess file, I add this code:

    php_value memory_limit 64M
    php_value upload_max_filesize 32M
    php_value post_max_size 32M

    But the errors there are yet...

    The following code is a bit error:
    WordPress database error Got a packet bigger than 'max_allowed_packet' bytes for query INSERT INTOwp_options(option_name,option_value,autoload) VALUES ('rewrite_rules', 'a:7212:{s:12:\\"robots\\\\.txt$\\";s:18:\\"index.php?robots=1\\";s:14:\\".*wp-atom.php$\\";s:19:\\"index.php?feed=atom\\";s:13:\\".*wp-rdf.php$\\";s:18:\\"index.php?feed=rdf\\";s:13:\\".*wp-rss.php$\\
    [continues...]

    When I see the database, I don't find "rewrite rules" in "option_name"...

    How to resolve?

  2. Shane G.
    Member
    Posted 3 years ago #

    Hi,

    You can do it either from shell access or contact your hosting service provider to increase the MySQL packet limit.

    Refer this article for that:

    http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html

    Thanks,

    Shane G.

  3. byronrode
    Member
    Posted 3 years ago #

    Erfo,

    Check that there are no duplicate rules in the .htaccess file. There should be the standard rules, and then add you rules within the <IfModule> wrapper below the standard WP rewrite rules.

    Cheers,
    Byron

  4. Erfo
    Member
    Posted 3 years ago #

    @Shane G.
    I set these rules in .htaccess file, is it ok?

    @byronrode

    In my .htaccess file I have this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    
    # Options +FollowSymlinks
    RewriteCond %{HTTP_REFERER} cnzz\.cn [NC,OR]
    RewriteCond %{HTTP_REFERER} qq829\.com [NC]
    RewriteRule .* - [F]
    
    php_value memory_limit 64M
    php_value upload_max_filesize 32M
    php_value post_max_size 32M
    
    redirect 301 "/example" http://site.it/page/example
    redirect 301 "http://site.it/example1" http://site.it/page/example1
    # I have another redirect 301
    
    </IfModule>
    
    # END WordPress

    What's wrong?

    Thanks to both

  5. Erfo
    Member
    Posted 3 years ago #

    Have you any solution?

  6. byronrode
    Member
    Posted 3 years ago #

    Hi Erfo,

    Apologies for the delay. Been a bit hectic.

    As far as I know, the problem I came across was using the redirect method

    redirect 301 "/example" http://site.it/page/example
    redirect 301 "http://site.it/example1" http://site.it/page/example1
    # I have another redirect 301

    you should rather change those to a RewriteRule

    Thanks,
    Byron

  7. sammyb
    Member
    Posted 3 years ago #

    Hi Erfo

    'max_allowed_packet' is a mySQL setting and has nothing to do with .htaccess. it defines the maximum size of any data packet that can be written to a single field in your mysql databse.

    the rewrite_rules refered to in the error are a row in the wp_options table of the wordpress database. WordPress uses these rules to generate the 'pretty permalinks' when using a custom permalink structure such as /%category%/%postname%.

    When you create a new page in wordpress extra rules are added to the array of rewrite rules in your database. More pages = more rewrite_rules

    what is happening here is that the number of rewrite rules created by your site is larger than the max_allowed_packet size as set in the mysql configuration on your server.

    Here's some info on how to increase the max_allowed_packet:
    http://www.liferay.com/web/guest/community/forums/-/message_boards/message/124969

    The only other solution is to reduce the number of pages on your site... not a great option really

    Sam

Topic Closed

This topic has been closed to new replies.

About this Topic