• Resolved mobizma

    (@mobizma)


    Hi guys,

    Love your plugin.

    Just wonder if performance or site slows down when so many debug.log entries even with WIP site with a few pages and no traffic yet.

    I get endless [in merely 1week 1MB log file] of these entries here below.

    I tried tweaking various settings but makes no difference.

    I am using Converter For Media [Pro] plugin to optimize images and turn them into WebP and AVIF. they set their own CF rules. With free plan on CF the WebP/AVIF isn’t cached by CF. So I am assuming this might be the cause as your plugin tries to set headers and the other plugin sets it.

    They have .htaccess file with rules that get priority over your plugin’s.

    Perhaps some adjustment to accommodate this is needed?

    With CF Pro I may not have this issue as all gets cached on their edge thanks to your plugin and the CFM one.

    But I worry the errors may indicate performance issues and I will have a big launch soon so please advise.

    Thank you for your help in advance, and for your time and this excellent free plugin.

    Here are a few examples from the debug.log file:

    [14-Jun-2023 22:57:18 UTC] PHP Warning: Undefined array key 6 in /home/….com/public_html/wp-content/plugins/wp-cloudflare-page-cache/libs/cache_controller.class.php on line 2734
    [14-Jun-2023 22:57:18 UTC] PHP Warning: Undefined array key 6 in /home/….com/public_html/wp-content/plugins/wp-cloudflare-page-cache/libs/cache_controller.class.php on line 2735

    [17-Jun-2023 13:28:36 UTC] PHP Warning: Cannot modify header information – headers already sent by (output started at /home/….com/public_html/wp-includes/functions.php:5309) in /home/….com/public_html/wp-admin/includes/misc.php on line 1431
    [17-Jun-2023 13:28:36 UTC] PHP Warning: Cannot modify header information – headers already sent by (output started at /home/….com/public_html/wp-includes/functions.php:5309) in /home/….com/public_html/wp-includes/functions.php on line 6896
    [17-Jun-2023 13:28:36 UTC] PHP Warning: Cannot modify header information – headers already sent by (output started at /home/….com/public_html/wp-includes/functions.php:5309) in /home/….com/public_html/wp-admin/admin-header.php on line 9

    and a ton of:

    [16-Jun-2023 17:32:56 UTC] PHP Warning: Cannot modify header information – headers already sent by (output started at /home/….com/public_html/wp-includes/functions.php:5309) in /home/….com/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1762
    [16-Jun-2023 17:32:56 UTC] PHP Warning: Cannot modify header information – headers already sent by (output started at /home/….com/public_html/wp-includes/functions.php:5309) in /home/….com/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1786

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor iSaumya

    (@isaumya)

    Hi @mobizma,
    This happens when you have other page caching plugins present in your website which is also trying to modify the header information like this plugin. When using this plugin you need to make sure no other page caching plugins are present in your website. If you have some, just deactivate and delete them from Wp Admin > plugins section.

    There is also a possibility that you might have some custom code in your theme where the theme is trying to modify the header information as a result the plugin can’t do it’s work.

    To check what’s going on… you should first try disabling all plugins you have except this one to see if you are still getting this issue. If you are still seeing this header already sent, then temporarily switch to a default WP theme and check again. This will help you identify if this is happening from other plugins or your theme.

    Thread Starter mobizma

    (@mobizma)

    Hi Sauma!

    [2] I use elementor Hello theme [super minimal plain vanilla] and the only plugin that would change headers would be the converter for media one.

    [1] I no longer use any caching plugins since using yours and converter for media plugin.

    [3] I did add custom code to htaccess for gzip. Aside from this maybe etag still left in the file from LS Cache. see below my code.

    [4] the converter for media plugin adds an .htaccess to uploads folder with:

    BEGIN Converter for Media

    ! — DO NOT EDIT PREVIOUS LINE — !

    RewriteEngine On RewriteOptions Inherit RewriteCond %{HTTP_ACCEPT} image/avif RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/$1.jpg.avif -f RewriteRule (.+).jpg$ /wp-content/uploads-webpc/uploads/$1.jpg.avif [NC,T=image/avif,L] RewriteCond %{HTTP_ACCEPT} image/avif RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/$1.png.avif -f RewriteRule (.+).png$ /wp-content/uploads-webpc/uploads/$1.png.avif [NC,T=image/avif,L] RewriteCond %{HTTP_ACCEPT} image/avif RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/$1.gif.avif -f RewriteRule (.+).gif$ /wp-content/uploads-webpc/uploads/$1.gif.avif [NC,T=image/avif,L] RewriteCond %{HTTP_ACCEPT} image/avif RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/$1.webp.avif -f RewriteRule (.+).webp$ /wp-content/uploads-webpc/uploads/$1.webp.avif [NC,T=image/avif,L] RewriteCond %{HTTP_ACCEPT} image/avif RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/$1.jpeg.avif -f RewriteRule (.+).jpeg$ /wp-content/uploads-webpc/uploads/$1.jpeg.avif [NC,T=image/avif,L]
    RewriteEngine On RewriteOptions Inherit RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/$1.jpg.webp -f RewriteRule (.+).jpg$ /wp-content/uploads-webpc/uploads/$1.jpg.webp [NC,T=image/webp,L] RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/$1.png.webp -f RewriteRule (.+).png$ /wp-content/uploads-webpc/uploads/$1.png.webp [NC,T=image/webp,L] RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/$1.gif.webp -f RewriteRule (.+).gif$ /wp-content/uploads-webpc/uploads/$1.gif.webp [NC,T=image/webp,L] RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/$1.webp.webp -f RewriteRule (.+).webp$ /wp-content/uploads-webpc/uploads/$1.webp.webp [NC,T=image/webp,L] RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/$1.jpeg.webp -f RewriteRule (.+).jpeg$ /wp-content/uploads-webpc/uploads/$1.jpeg.webp [NC,T=image/webp,L]

    ! — DO NOT EDIT NEXT LINE — !

    END Converter for Media

    and it adds in wp-content/ .htaccess:

    BEGIN Converter for Media

    ! — DO NOT EDIT PREVIOUS LINE — !

    RewriteEngine On RewriteOptions Inherit RewriteCond %{HTTP_ACCEPT} image/avif RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpg.avif -f RewriteRule (.+).jpg$ /wp-content/uploads-webpc/$1.jpg.avif [NC,T=image/avif,L] RewriteCond %{HTTP_ACCEPT} image/avif RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.png.avif -f RewriteRule (.+).png$ /wp-content/uploads-webpc/$1.png.avif [NC,T=image/avif,L] RewriteCond %{HTTP_ACCEPT} image/avif RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.gif.avif -f RewriteRule (.+).gif$ /wp-content/uploads-webpc/$1.gif.avif [NC,T=image/avif,L] RewriteCond %{HTTP_ACCEPT} image/avif RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.webp.avif -f RewriteRule (.+).webp$ /wp-content/uploads-webpc/$1.webp.avif [NC,T=image/avif,L] RewriteCond %{HTTP_ACCEPT} image/avif RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpeg.avif -f RewriteRule (.+).jpeg$ /wp-content/uploads-webpc/$1.jpeg.avif [NC,T=image/avif,L]
    RewriteEngine On RewriteOptions Inherit RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpg.webp -f RewriteRule (.+).jpg$ /wp-content/uploads-webpc/$1.jpg.webp [NC,T=image/webp,L] RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.png.webp -f RewriteRule (.+).png$ /wp-content/uploads-webpc/$1.png.webp [NC,T=image/webp,L] RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.gif.webp -f RewriteRule (.+).gif$ /wp-content/uploads-webpc/$1.gif.webp [NC,T=image/webp,L] RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.webp.webp -f RewriteRule (.+).webp$ /wp-content/uploads-webpc/$1.webp.webp [NC,T=image/webp,L] RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpeg.webp -f RewriteRule (.+).jpeg$ /wp-content/uploads-webpc/$1.jpeg.webp [NC,T=image/webp,L]
    Header always set Cache-Control “private” Header append Vary “Accept”

    ! — DO NOT EDIT NEXT LINE — !

    END Converter for Media

    I have security hardening codes, the WP section and then this in my ROOT .htaccess:


    # Compress HTML, CSS, JavaScript, Text, XML and fonts
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    AddOutputFilterByType DEFLATE application/x-font
    AddOutputFilterByType DEFLATE application/x-font-opentype
    AddOutputFilterByType DEFLATE application/x-font-otf
    AddOutputFilterByType DEFLATE application/x-font-truetype
    AddOutputFilterByType DEFLATE application/x-font-ttf
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE font/opentype
    AddOutputFilterByType DEFLATE font/otf
    AddOutputFilterByType DEFLATE font/ttf
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE image/x-icon
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/xml # Remove browser bugs (only needed for really old browsers)
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    Header append Vary User-Agent
    BEGIN LiteSpeed The directives (lines) between "BEGIN LiteSpeed" and "END LiteSpeed" are dynamically generated, and should only be modified via WordPress filters. Any changes to the directives between these markers will be overwritten. SetEnv noabort 1 END LiteSpeed BEGIN WP Cloudflare Super Page Cache The directives (lines) between "BEGIN WP Cloudflare Super Page Cache" and "END WP Cloudflare Super Page Cache" are dynamically generated, and should only be modified via WordPress filters. Any changes to the directives between these markers will be overwritten. ExpiresActive on ExpiresByType application/xml "access plus 0 seconds" ExpiresByType text/xsl "access plus 0 seconds"
    Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0"
    Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0"
    Header set Cache-Control "public, must-revalidate, proxy-revalidate, immutable, max-age=2592000, stale-while-revalidate=86400, stale-if-error=604800"
    Header set Cache-Control "public, must-revalidate, proxy-revalidate, immutable, max-age=31536000, stale-while-revalidate=86400, stale-if-error=604800"
    RewriteCond %{REQUEST_URI} ^(.)?/wp-content/wp-cloudflare-super-page-cache/sonohz.com/debug.log(.)$ RewriteRule ^(.*)$ - [F]
    Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0" END WP Cloudflare Super Page Cache
    Plugin Contributor iSaumya

    (@isaumya)

    Hi @mobizma,
    Can you momentarily remove all the htaccess rules except the ones added by WP core and this plugin and then check if the issue gets resolved or not.

    Thread Starter mobizma

    (@mobizma)

    If I remove the other htaccess I suspect it’d basically destroy the converter for media plugin interaction with CloudFlare or functionality. And I don’t wish to disable or stop using that plugin.

    We simply need yours to play with it without conflict.

    The other root .htaccess rules are simply ones I have in all my many websites to harden security, like file access to debug, hitting on author URLs etc. nothing to do with headers. Those other sites have zero such debug log warnings. I don’t have your plugin on them not converter for media.

    I don’t use many security plugins and add custom code in a custom functions file, but that’s not for altering headers. And deactivating the file is not changing anything. I have security and bloat related functions, like:

    /** hide wp version – Remove meta generator **/
    // remove version from head
    remove_action(‘wp_head’, ‘wp_generator’);

    // remove version from rss
    add_filter(‘the_generator’, ‘__return_empty_string’);

    Plus some other custom functions to disable self-pingbacks, emojis, hide author login, disable embeds & oEmbed discovery, remove wlwmanifest link, version mentions, disable XML/RPC etc.

    Hence my intuitive logic makes me think since yours and CFM both try to set headers and since you have even a setting to play along with other plugins, perhaps it needs expanding to resolve this issue.

    But I am not a coder, so may get it all wrong.

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @mobizma,

    those functions are not doing anything. I’m not asking you to delete those htacess rule for good. I’m asking you delete them for testing, you can save them in a notepad so that you can add them once the test is done.

    Basically you need to look what else is modifying header. From my experience it is a plugin. That’s why I suggested you to test with all your other plugin disabled and then of the issue is not solved try a default theme. But my hunch is it’s a plugin.

    Thread Starter mobizma

    (@mobizma)

    Correct and I assume it is the image optimization plugin which simply needs yours to support it. Or communicate with their author perhaps to be supported. Nothing else I can think about is causing this.

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @mobizma,
    First you need to test and confirm if it’s the image optimization plugin or not. There is no way to support it if they are also manipulating headers. As when using this plugin, other plugins are not supposed to manipulate the headers.

    If you can confirm that it is this plugin which is causing the issue, I would suggest you to opt for a different image optimization system like Optimole, Imagekit.io or maybe Cloudflare Pro plan.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘headers already sent error log regardless what I do’ is closed to new replies.