Title: PHP Warning Cannot modify header information
Last modified: December 5, 2022

---

# PHP Warning Cannot modify header information

 *  Resolved [SimpleRick](https://wordpress.org/support/users/keramikoch/)
 * (@keramikoch)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-warning-cannot-modify-header-information-21/)
 * Hi dear Litespeed Support,
 * unfortunately I did not get an answer yet
 * Report number: GYQQSDEL
    Report date: 11/28/2022 09:03:44
 * I get the following error:
    [26-Nov-2022 12:30:39 UTC] PHP Warning Cannot modify
   header information – headers already sent in xxx/public_html/wp-content/plugins/
   litespeed-cache/src/vary.cls.php on line 735
 * So there must be an erorr with the code line 735 (maybe whitespace or soemthing?):
   
   setcookie( self::$_vary_name, $val, $expire, $path?: COOKIEPATH, COOKIE_DOMAIN,
   $is_ssl, true );
 * Could you please fix it?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fphp-warning-cannot-modify-header-information-21%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-warning-cannot-modify-header-information-21/#post-16261136)
 * This seems to be a bug that hopefully will be fixed in next update release. If
   anything goes wrong at your page, disable Guestmode temporary and check again
   if next update has been released.
 * This error has already been reported by other users, so you are not alone.
 *  Thread Starter [SimpleRick](https://wordpress.org/support/users/keramikoch/)
 * (@keramikoch)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-warning-cannot-modify-header-information-21/#post-16262468)
 * @cachecrawler,
    thanks for you response. The error was reported at least already
   a year ago: [https://wordpress.org/support/topic/cannot-modify-header-information-175/](https://wordpress.org/support/topic/cannot-modify-header-information-175/)
 * So do you know what is wrong about this line?
 * setcookie( self::$_vary_name, $val, $expire, $path?: COOKIEPATH, COOKIE_DOMAIN,
   $is_ssl, true );
 * So we can fix it until an update is release? Maybe there should not be two “::”
   after the word “self”, but I am not a php programer.
 * Thanks in advance.
 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-warning-cannot-modify-header-information-21/#post-16263995)
 * > Maybe there should not be two “::” after the word “self”,
 * No, this is just PHP.
 * Why do you set no-cache at first request at your page when you can make it caching
   with a simple hack to make GDPR available?
 *  Thread Starter [SimpleRick](https://wordpress.org/support/users/keramikoch/)
 * (@keramikoch)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-warning-cannot-modify-header-information-21/#post-16268099)
 * > Why do you set no-cache at first request at your page when you can make it 
   > caching with a simple hack to make GDPR available?
 * How do I do that?
 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-warning-cannot-modify-header-information-21/#post-16268295)
 * 1. remove the no-cache rule.
    2. add this code to your .htaccess, but outside
   of LiteSpeed marker.
 *     ```
       <IfModule Litespeed>
       	RewriteRule .* - [E=cache-vary:viewed_cookie_policy]
        </IfModule>
       ```
   
 * The above code adds an additional cache vary for GDPR cookie, so views with and
   without cookie get different cache copy. But aware the cache of this new vary
   can’t be warmuped by the crawler, because the built-in crawler doesn’t know this
   cache vary.
 * **Don’t forget to do a cache purge_all!!!!**
    -  This reply was modified 3 years, 6 months ago by [serpentdriver](https://wordpress.org/support/users/serpentdriver/).
 *  [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/php-warning-cannot-modify-header-information-21/#post-16311578)
 * “setcookie() defines a cookie to be sent along with the rest of the HTTP headers.
   Like other headers, cookies must be sent before any output from your script (
   this is a protocol restriction). This requires that you place calls to this function
   prior to any output, including any tags as well as any whitespace.”
    -  This reply was modified 3 years, 5 months ago by [AITpro](https://wordpress.org/support/users/aitpro/).
 *  [wordna](https://wordpress.org/support/users/wordna/)
 * (@wordna)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/php-warning-cannot-modify-header-information-21/#post-16364181)
 * I see the same issue.
 *  [usabe](https://wordpress.org/support/users/usabe/)
 * (@usabe)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/php-warning-cannot-modify-header-information-21/#post-16419593)
 * Due to inactivity of this topic and the continuous lscwp updates, I will mark
   this topic as “resolved” for now. If you still have such issues, please feel 
   free to open a ticket with further information by emailing to [support@litespeedtech.com](https://wordpress.org/support/topic/php-warning-cannot-modify-header-information-21/support@litespeedtech.com?output_format=md).
   Remember to reference this topic and ask to assign your ticket to Abe. I will
   check into this further from there.
 *  [neotek](https://wordpress.org/support/users/neotek/)
 * (@neotek)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/php-warning-cannot-modify-header-information-21/#post-16494370)
 * Same issue here showing up in the PHP error log. Any news on the update?

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘PHP Warning Cannot modify header information’ is closed to new replies.

 * ![](https://ps.w.org/litespeed-cache/assets/icon-256x256.png?rev=2554181)
 * [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/litespeed-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/litespeed-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/litespeed-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/litespeed-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/litespeed-cache/reviews/)

 * 9 replies
 * 6 participants
 * Last reply from: [neotek](https://wordpress.org/support/users/neotek/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/php-warning-cannot-modify-header-information-21/#post-16494370)
 * Status: resolved