I have a file that includes a file called sitemap.html and in the Sitemap file, I have the following code:
<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> <url> <loc><?php echo SITE_URL . '/'; ?></loc> <changefreq>monthly</changefreq> <priority>1.00</priority> </url> <?php foreach ($this->data->content as $content): ?> <url> <loc><?php echo SITE_URL . $content->permalink; ?></loc> <lastmod><?php echo date("Ymd", $content->publish_date); ?></lastmod> <changefreq>monthly</changefreq> <priority><?php echo $content->sitemap_index; ?></priority> </url> <?php endforeach; ?> </urlset>
Everything looks fine, but I get 500 error message:
PHP password analysis error: syntax error, unexpected "version" (T_STRING) in sitemap.html on line 1
As you can see, I use <?xml and not <?php , so why is he trying to parse it like PHP?
At first I thought it was magic quotes that were causing the problem, but when I do var_dump get_magic_quotes_gpc () , I get bool(false) , so the magic quotes are not even included.
Also, in my php.ini I see that magic_quotes is OFF .
As an alternative to fix it, I replaced the first line with the following text:
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
But I'm still wondering what is going on.
I have other websites hosted on the same server (PHP version 5.4.45), and I am not getting the PHP Parse Error on the site map of other websites ...
Any idea what might cause this error?