Title: AMP PHP error
Last modified: December 22, 2022

---

# AMP PHP error

 *  [ecronik](https://wordpress.org/support/users/ecronik/)
 * (@ecronik)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/amp-php-error/)
 * Hi Marko,
 * I hope you’re doing well! I’ve found this in my debug.log –
 * `PHP Notice: Function amp_is_available was called **incorrectly**. amp_is_available()(
   or amp_is_request(), formerly is_amp_endpoint()) was called too early and so 
   it will not work properly. WordPress is currently doing the w3tc_footer_comment
   hook. Calling this function before the wp action means it will not have access
   to WP_Query and the queried object to determine if it is an AMP response, thus
   neither the amp_skip_post() filter nor the AMP enabled toggle will be considered.
   It appears the plugin with slug w3-total-cache is responsible; please contact
   the author. Please see [Debugging in WordPress](https://wordpress.org/support/article/debugging-in-wordpress/)
   for more information. (This message was added in version 2.0.0.) in x/wp-includes/
   functions.php on line 5833`
 * WP 6.0.3, PHP 8.0.26, official AMP plugin (using ?amp=1), W3TC AMP extension (
   query string, postfix “amp”)
 * Did add amp as accepted query string on the site, as you adviced [here](https://wordpress.org/support/topic/amp-parameter/#post-16122785).
 * Thanks for your help,
 * eC
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Famp-php-error%2Fpage%2F2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 16 through 17 (of 17 total)

[←](https://wordpress.org/support/topic/amp-php-error/?output_format=md) [1](https://wordpress.org/support/topic/amp-php-error/?output_format=md)
2

 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/amp-php-error/page/2/#post-16456568)
 * Hello [@ecronik](https://wordpress.org/support/users/ecronik/)
 * First of all, sorry for the late reply.
   Regarding your question about the TTL,
   this is a trial-and-error process. So you need to check and try and see how this
   behaves in your environment.As for the error messages, can you please let me 
   know if those are now fixed for you?
 * Thanks!
 *  Thread Starter [ecronik](https://wordpress.org/support/users/ecronik/)
 * (@ecronik)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/amp-php-error/page/2/#post-16458376)
 * Hi [@vmarko](https://wordpress.org/support/users/vmarko/)
 * No, the error messages still occur. Also, occasionally this one with changing
   filenames:
 * `[09-Feb-2023 16:38:37 UTC] PHP Warning: filesize(): stat failed for /…/wp-content/
   cache/object/d2f/438/d2f43839d111e37ad033f85d8dee5f63.php in /…/wp-content/plugins/
   w3-total-cache/Cache_File.php on line 159`
 * All plugins etc. up-to-date.
 * Unfortunately, I also haven’t managed to fix the admin-ajax.php error after a
   while when using load-more buttons etc. I tried excluding jquery.min.js and tagdiv_theme.
   min.js from RocketLoader, excluding admin-ajax.php from page cache, had HTML/
   XML TTL already down at 15 minutes, but still no luck. Maybe you have another
   idea about this as well?
 * Thanks,
 * eC

Viewing 2 replies - 16 through 17 (of 17 total)

[←](https://wordpress.org/support/topic/amp-php-error/?output_format=md) [1](https://wordpress.org/support/topic/amp-php-error/?output_format=md)
2

The topic ‘AMP PHP error’ 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/)

 * 18 replies
 * 3 participants
 * Last reply from: [ecronik](https://wordpress.org/support/users/ecronik/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/amp-php-error/page/2/#post-16458376)
 * Status: not resolved