Ahmad Naser Turnkey Ecosystem Ahmad Naser
October 16, 2022

FIX BROKEN SITEMAP.XML: ERROR LINE 2 AT COLUMN 6

Published in the Ahmad Naser ecosystem. Estimated reading time: 1 minute.

This problem is caused by an empty line before or after the PHP script, you need to search all your files and then discover the empty space and remove it

If you want to search and print a list of all PHP files that begin with an arbitrary empty line, SSH into your site and run this in your terminal:

find . -name "*.php" -type f -size +0 -exec gawk 'STARTFILE{if ($0 == "") print FILENAME}' {} +

If you want to search and print a list of all PHP files that end with an arbitrary empty line, SSH into your site and run this in your terminal:

find . -name "*.php" -type f -size +0 -exec gawk 'FNR==1{if ($0 == "") print FILENAME}' {} +

Leave a Reply

Your email address will not be published. Required fields are marked *