WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
Wp-Super-Cache and 500 errors ("Premature end of script headers") (2 posts)

  1. George Lerner
    Member
    Posted 9 months ago #

    WordPress 3.6.0 and 3.6.1, Multi-Site, WP Super Cache 1.3.2
    Apache, PHP Version 5.2.17, [HTTP_ACCEPT_ENCODING] => gzip, deflate

    This is not really a wp-super-cache bug, but it shows up in wp-super-cache as mysterious pages giving 500 Server Errors or partially blank pages.

    Note: Other sypmtoms: WordPress Update hangs, WordPress plugin update hangs, and PHP Unzip hangs [e.g. $zip->extractTo($path.'/folder') or copy("zip://".$zipFullPath.'#'.$filename, $destPath.$destName); ]

    So, it is likely a PHP Unzip bug (in an Old version of PHP) that produces no error code, no log messages, and has no direct PHP method of testing it.

    WP Super Cache configured to use PHP caching, Cache Test: Successful.
    Change to .htaccess caching, Plugin section of /wp-admin/options-general.php?page=wpsupercache&tab=settings is blank (WordPress menus on left do display).

    I recommend having 644 rights on .htaccess, no script should be allowed to modify a key security file!
    Manually added WPSuperCache lines to .htaccess. No change in WPSupercache display.

    Manually edit /public_html/wp-content/wp-cache-config.php, change $wp_cache_mod_rewrite = 1; to $wp_cache_mod_rewrite = 0; (restores WPSuperCache settings page display; Advanced Tab has "Use PHP to serve cache files" selected)
    .htaccess still has WPSuperCache lines. Cache test successful.

    On Advanced tab, Add "Compress pages so they’re served more quickly to visitors. (Recommended)".

    Cache Test:
    Fetching [URL] to prime cache: OK
    Fetching first copy of [URL]: OK (1.html)
    Fetching second copy of [URL]: OK (2.html)
    One or more page requests failed:
    Page 1: 500 (Internal Server Error)
    Page 2: 500 (Internal Server Error)
    The pages do not match! Timestamps differ or were not found!

    Uncheck "Compress pages so they’re served more quickly to visitors. (Recommended)" on Advanced tab.
    Cache Test successful

    So, there are versions of PHP out there that have bugs in Unzip, so unzipping hangs or returns 500 Server Error (specifically, "Premature end of script headers" in $_SERVER['REDIRECT_ERROR_NOTES'] ). Unzip returns nothing (fails with a time-out error?), so the "cached" page is likely 0 bytes, so there are no HTML page headers sent.

    Donncha: I recommend modifying wp-super-cache: testing when someone attempts setting "Compress pages..." whether Unzip works (the Cache Test returning 500 Error), and let the user know if it fails, and prohibit use of compressing if it fails.
    I recommend testing for cached page returned with 0 bytes, and serving the uncached page (or un-zipped page) instead -- with error log message.

    Looks like this PHP bug might have been fixed in PHP Version 5.3.4 09-Dec-2010 - "Fixed crash in zip extract method" http://www.php.net/ChangeLog-5.php#5.3.4

    Others probably have been affected by the same PHP Unzip bug:
    See http://wordpress.org/support/topic/plugin-wp-super-cache-error-500-on-wp-admin-after-activating?replies=15
    See http://wordpress.org/support/topic/after-install-of-wp-super-cache-i-cant-go-to-wp-admin-error-500?replies=2
    See http://wordpress.org/support/topic/wp-super-cache-error-500-on-test?replies=1
    See http://wordpress.org/support/topic/after-install-of-wp-super-cache-i-cant-go-to-wp-admin-error-500?replies=2

    http://wordpress.org/plugins/wp-super-cache/

  2. George Lerner
    Member
    Posted 9 months ago #

    WP-Super-Cache (and WordPress Updates, and BackWPUp) works with compression after talking to my hosting provider; they already had a newer PHP installed, a .htaccess configuration change switched me to the newer PHP.

    See http://lcblog.lernerconsult.com/2013-php-unzip-bug-makes-wordpress-updates-hang/ for PHP code demonstrating the bug is in PHP not WordPress. (WordPress should test if PHP Unzip has this bug!)

Reply

You must log in to post.

About this Plugin

About this Topic