Title: Multiple PHP Warnings
Last modified: March 3, 2023

---

# Multiple PHP Warnings

 *  Resolved [Oleg Meglin](https://wordpress.org/support/users/omeglin/)
 * (@omeglin)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/multiple-php-warnings-3/)
 * Hello,
 * I’m currently testing the Free Version of WP Total Cache. You have built a great
   plugin there. I’m thinking of trying the pro version soon too.
 * One thing that I have noticed so far and that bothers me a lot are two PHP warnings
   that keep appearing:
 *     ```wp-block-code
       PHP Warning:  Undefined variable $rewrite_rules in /home/users/name/www/www.example.com/public/wp-content/plugins/w3-total-cache/BrowserCache_Environment.php on line 97
   
       PHP Warning:  foreach() argument must be of type array|object, null given in /home/users/name/www/www.example.com/public/wp-content/plugins/w3-total-cache/BrowserCache_Environment.php on line 160
       ```
   
 * This Warnings appears on every single page load in the backend while im navigation
   through the “Performance” settings and also when I delete the cache from the 
   admin bar.
 * I’m using the latest WordPress Version and also the latest WP Total Cache Version.
 * **This is my configuration:**
    - Page Cache: enabled (Redis)
    - Minify: enabled (Redis)
       * Mode: Auto
       * HTML Tidy
       * JSMin
       * CSS Tidy
    - Database Cache: enabled (Redis)
    - Object Cache: enabled (Redis)
    - Browser Cache: enabled
 * Let me know if you need some more information about my system.
 * Many thanks for the support.

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

 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/multiple-php-warnings-3/#post-16525157)
 * Hello [@omeglin](https://wordpress.org/support/users/omeglin/)
 * Thank you for reaching out and I am happy to assist you with this.
 * Can you please share if you are on apache or Nginx? Also, Can you please share
   if your filesystem permissions allow writing to files and folders to allow W3TC
   to add the Browser Cache rules??
 * Thanks!
 *  Thread Starter [Oleg Meglin](https://wordpress.org/support/users/omeglin/)
 * (@omeglin)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/multiple-php-warnings-3/#post-16525487)
 * Hi Marko,
 * thank you for the reply. Here are some more informations:
    - Webserver: Apache 2.4
    - PHP: 8.1.14
    - Using the recommended WordPress file permission: 644 on files and 755 on folders
 *  Thread Starter [Oleg Meglin](https://wordpress.org/support/users/omeglin/)
 * (@omeglin)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/multiple-php-warnings-3/#post-16528889)
 * Hi Marko,
 * I have to correct one of my given information. **PHP 8.0.27 is in use** and not
   8.1.14.
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/multiple-php-warnings-3/#post-16531951)
 * Hello [@omeglin](https://wordpress.org/support/users/omeglin/)
 * Thank you for your feedback.
   Can you please share if the Browser Cache is enabled
   in the General settings and let me know which settings are enabled in Performance
   >Browser Cache, and if the W3TC rules are in your .htaccess file?
 * Thanks!
 *  Thread Starter [Oleg Meglin](https://wordpress.org/support/users/omeglin/)
 * (@omeglin)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/multiple-php-warnings-3/#post-16532168)
 * Hello [@vmarko](https://wordpress.org/support/users/vmarko/),
 * sure.
 * Browser Cache is enabled. Here is a screenshot with all Settings:
 * ![](https://i0.wp.com/iili.io/HWjoYAB.png?ssl=1)
 * I don’t see any W3TC rules inside the `.htaccess` file.
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/multiple-php-warnings-3/#post-16533486)
 * Hello [@omeglin](https://wordpress.org/support/users/omeglin/)
 * Thank you for your feedback. Well this is odd!
   Can the .htaccess should have 
   the W3TC rules for Browser Caching according to your settings?Can you please 
   confirm you are checking the .htaccess in your website folder?Also, please check
   the Performance>Install section, which has all the rewrite rules according to
   your settings.You can manually add them to your .htaccess
 * Thanks!
 *  Thread Starter [Oleg Meglin](https://wordpress.org/support/users/omeglin/)
 * (@omeglin)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/multiple-php-warnings-3/#post-16535420)
 * Hi [@vmarko](https://wordpress.org/support/users/vmarko/),
 * thank you for your commitment.
 * Yes, I’m checking the correct .htaccess file. I suspect the rules disappeared
   because the .htaccess file was accidentally overwritten. So the missing rules
   shouldn’t be a bug in your plugin.
 * However, it would be nice if your plugin catches the errors in such a case and
   gives you the opportunity to restore the rules.
 * When I visit the page you suggested (Performance > Install) I get more errors.
   One of them is new:
 *     ```wp-block-code
       [07-Mar-2023 08:54:59 UTC] PHP Warning:  Undefined variable $rewrite_rules in /www/www.example.com/public/wp-content/plugins/w3-total-cache/BrowserCache_Environment.php on line 97
       [07-Mar-2023 08:54:59 UTC] PHP Warning:  foreach() argument must be of type array|object, null given in /www/www.example.com/public/wp-content/plugins/w3-total-cache/BrowserCache_Environment.php on line 160
       [07-Mar-2023 08:54:59 UTC] PHP Warning:  Undefined variable $other_areas in /www/www.example.com/public/wp-content/plugins/w3-total-cache/inc/options/common/header.php on line 372
       [07-Mar-2023 08:54:59 UTC] PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /www/www.example.com/public/wp-content/plugins/w3-total-cache/inc/options/common/header.php:372
       Stack trace:
       #0 /www/www.example.com/public/wp-content/plugins/w3-total-cache/inc/options/common/header.php(372): count()
       #1 /www/www.example.com/public/wp-content/plugins/w3-total-cache/inc/options/install.php(8): require('...')
       #2 /www/www.example.com/public/wp-content/plugins/w3-total-cache/Generic_Page_Install.php(28): include('...')
       #3 /www/www.example.com/public/wp-content/plugins/w3-total-cache/Base_Page_Settings.php(71): W3TC\Generic_Page_Install->view()
       #4 /www/www.example.com/public/wp-content/plugins/w3-total-cache/Root_AdminMenu.php(289): W3TC\Base_Page_Settings->options()
       #5 /www/www.example.com/public/wp-includes/class-wp-hook.php(308): W3TC\Root_AdminMenu->options()
       #6 /www/www.example.com/public/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
       #7 /www/www.example.com/public/wp-includes/plugin.php(517): WP_Hook->do_action()
       #8 /www/www.example.com/public/wp-admin/admin.php(259): do_action()
       #9 {main}
         thrown in /www/www.example.com/public/wp-content/plugins/w3-total-cache/inc/options/common/header.php on line 372
       ```
   
 * **What I tried to restore the rules:**
    1. Deactivate and activate the Plugin. Didn’t help.
    2. Changed various settings to force the plugin to re-modify the .htaccess. Didn’t
       help.
    3. Run the Setup Guide again. Didn’t help.
    4. Disabled and enabled the Browser Cache to force the plugin to re-modify the .
       htaccess. Didn’t help.
 * **Again as a summary to avoid misunderstandings:**
    - We are talking about the standard .htaccess file, which is located in the 
      root directory of the WordPress installation.
    - This .htaccess file should have the file permission “644”.
    - This .htaccess file should contain a few rules created by your plugin.
 * Are these statements correct?
 * Is there a way to force the plugin to create the rules?
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/multiple-php-warnings-3/#post-16539973)
 * Hello [@omeglin](https://wordpress.org/support/users/omeglin/)
 * Thank you for your feedback.
 * The .htaccess should be in the folder of your website. Meaning in the wordpress
   installation /yourwebstite.com/.htaccess
 * It should contain rewrite rules depending on the configuration **BEGIN W3TC Browser
   Cache**
 * Let me make tests and check for those errors/warnings since I was not able to
   replicate this.
 * Sharing the website URL and where the website is hosted would be helpful.
 * Thanks!
 *  Thread Starter [Oleg Meglin](https://wordpress.org/support/users/omeglin/)
 * (@omeglin)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/multiple-php-warnings-3/#post-16540739)
 * Hi [@vmarko](https://wordpress.org/support/users/vmarko/),
 * I tried to replicate the errors on a fresh installed WordPress system. I installed
   a few of the Plugins that are also installed on the system with the errors. However,
   only a few plugins that I considered critical (like Really Simple SSL Pro and
   Siteground Security). **I couldn’t replicate the errors either.**
 * Unfortunately, I cannot make the link to the affected page public. I’m also running
   out of time to do more research on this issue. So I would leave it alone for 
   now.
 * There could be so many causes. The system is also a bit more complicated:
    - The system is a bit old (built in 2016).
    - The theme does not support Gutenberg (Classic Editor mode enabled).
    - It used to be a multisite and has been converted to a single site.
    - There are 33 plugins installed.
 * If I ever find the cause of the error, I’ll let you know. Thank you again for
   your commitment.
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/multiple-php-warnings-3/#post-16540968)
 * Hello [@omeglin](https://wordpress.org/support/users/omeglin/)
 * Thank you for your feedback.
 * So it’s something specific to the environment and other plugins. I understand
   that sharing more specific information is not possible.
 * Please drop us a note directly via the plugin in Performance>Support>Bug report
   if you want to explore this further and share more details.
 * Thanks again!

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

The topic ‘Multiple PHP Warnings’ is closed to new replies.

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

 * 10 replies
 * 2 participants
 * Last reply from: [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/multiple-php-warnings-3/#post-16540968)
 * Status: resolved