DEV Community

Wajeeh Shaikh
Wajeeh Shaikh

Posted on

Permission denied to write sitemap.xml

I have created a PHP script for my PHP ecommerce website , that whenever I run this script it replaces new sitemap inside sitemap.xml file. this script works great locally but when running this script on live server i got this error:

{warning: file_put_contents(../sitemap.xml): failed to open stream: Permission denied in /var/www/mywwebsite.com/sitemap-maker.php on line 45}

On local machine its working perfectly on apache/xamp, but on live its creating error which is mentioned above. live web server is: Nginx

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay