Forum Moderators: coopster
I've researched and determined that I needed to add "AddType application/x-httpd-php .xml" to my .htaccess file, which I've done. Now, I know I have the ability to use .htaccess files in my directories as I use them for mod_rewrites and permissions, but for some reason this does not force PHP to pre-process a file with a .xml extension. However, when I run the .xml feed URL through a validator it tells me "Feeds should not be served with the "application/x-httpd-php" media type", which would seem to indicate that Apache is sending the file out via PHP, but I can see all my PHP coding in the .xml file when I view it in a browser.
Any ideas what I missed?
served with the "application/x-httpd-php" media type", which would seem to indicate that Apache is sending the file out via PHP,
header("Content-type: application/xml") The Web doesn't has no concept of "filename extensions". If the url [example.com...] returns Content-type: application/xml, then that URL points to a XML resource. Anything that tries to guess the filetype by its "extension" is broken. (Yes this includes IE).
I've also tried application/xml as well and the result is the same.
And my .htaccess file has:
AddType application/x-httpd-php .xml
According to every tutorial I've found and every post I read on WebmasterWorld, everything is set up okay. However, regardless, when I try to view the XML file or validate it the PHP code shows as if it wasn't parsed at all.
In my situation my version of PHP was not compiled using the --with-xml option, so it was not set up to process the XML and would give me error messages about missing functions and the like.
I downloaded the latest version of PHP4, recompiled it and thought the problem was solved, but it stuck around. Later I found out that the directory the new modphp4 file was placed in was not where Apache expected it to be. As soon as I moved it into the right place it has been happily ever after.
Do you know your PHP was compiled with XML support?
Contact your host/server admin. Apache (assuming that's your web server) needs to be explicitly configured to allow the "AddType" directive in .htaccess files.
Specifically, you'll need the AllowOverride directive configured with a directive-type of "FileInfo" or "All".
You can read more in the apache documentation, at the following URL
[httpd.apache.org...]