Title: Sitemap error when using PHP8
Last modified: September 12, 2023

---

# Sitemap error when using PHP8

 *  Resolved [jackyliao](https://wordpress.org/support/users/jackyliao/)
 * (@jackyliao)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/sitemap-error-when-using-php8/)
 * Hi,
 * Sitemap gives website error when I use PHP8,but it works fine when using PHP7.4
 * How can I solve this problem?
 * > [Sitemap error when using PHP8](https://imgur.com/a/elJlTr8)

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

 *  Plugin Support [Rank Math Support](https://wordpress.org/support/users/rankmathteam/)
 * (@rankmathteam)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/sitemap-error-when-using-php8/#post-17044315)
 * Hello [@jackyliao](https://wordpress.org/support/users/jackyliao/),
   Thank you
   for contacting support.That error comes from a constant that should be defined
   by WordPress by default but on your website is not being defined.There are 2 
   ways to fix this issue:
    1. You can define the constant `FS_CHMOD_FILE` in your `wp-config.php` file.
    2. You can disable the caching from the sitemap by using the following filter: 
       [https://rankmath.com/kb/exclude-sitemaps-from-caching/#transient-cache](https://rankmath.com/kb/exclude-sitemaps-from-caching/#transient-cache)
 * Hope this helps solve your issues.
   Don’t hesitate to get in touch if you have
   any other questions.
 *  Thread Starter [jackyliao](https://wordpress.org/support/users/jackyliao/)
 * (@jackyliao)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/sitemap-error-when-using-php8/#post-17046097)
 * Thank you. I successfully solved my issues.

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

The topic ‘Sitemap error when using PHP8’ is closed to new replies.

 * ![](https://ps.w.org/seo-by-rank-math/assets/icon.svg?rev=3438330)
 * [Rank Math SEO – AI SEO Tools to Dominate SEO Rankings](https://wordpress.org/plugins/seo-by-rank-math/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/seo-by-rank-math/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/seo-by-rank-math/)
 * [Active Topics](https://wordpress.org/support/plugin/seo-by-rank-math/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/seo-by-rank-math/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/seo-by-rank-math/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [jackyliao](https://wordpress.org/support/users/jackyliao/)
 * Last activity: [2 years, 8 months ago](https://wordpress.org/support/topic/sitemap-error-when-using-php8/#post-17046097)
 * Status: resolved