neo926 Posted February 9, 2009 Share Posted February 9, 2009 I have an RSS feed for my site that pulls data from my MySQL database, so since it's an XML file and uses PHP in it, I have added AddType application/x-httpd-php .xml So that the XML file displays properly. Well, that's been working fine until about a month ago. Our server crashed and our web host had to rebuild it. Well, when they rebuilt it, the XML file no longer displays properly. We actually just moved to a new webhost, but I still seem to be having the same problems. Basically the PHP code in the file isn't being parsed at all. For example: http://secondcitysaint.com.s60090.gridserver.com/rss2.php Here's the code with a .php extension. Works fine. http://secondcitysaint.com.s60090.gridserver.com/rss2.xml But when I change it to a .xml extension, it doesn't work at all. My .htaccess file is correct as far as I know, and as I've said, it used to work, for years, I didn't change anything, but clearly something got screwed up somewhere, and I don't have a clue what it could be. I know that ultimately I could just change my RSS feed to point to the .php extension, but all of my readers already subscribe to the .xml file, so I'd rather not do that if at all possible. Any help would be appreciated. Link to comment https://forums.phpfreaks.com/topic/144424-solved-treating-xml-file-as-php-htaccess-not-working/ Share on other sites More sharing options...
ratcateme Posted February 9, 2009 Share Posted February 9, 2009 did you have a look at the source of the link <? header('Content-type: text/xml'); ?> <rss version="2.0"> <channel> <title>SecondCitySaint.com</title> <description>It's About Me</description> <link>http://secondcitysaint.com/</link> <copyright>All material copyright 2004-2009 Mike Maloney</copyright> <item> <title> <![CDATA[ <?php echo "Hi."; ?> ]]> </title> <description> <![CDATA[ <?php echo "Hello again"; ?> ]]> </description> <link>http://secondcitysaint.com/index.php?id=<?php echo "243"; ?></link> </item> </channel> </rss> your server doesn't have short tags enabled (<?) try adding <?php to the start or updating you php.ini to allow short tags Scott. Link to comment https://forums.phpfreaks.com/topic/144424-solved-treating-xml-file-as-php-htaccess-not-working/#findComment-757888 Share on other sites More sharing options...
neo926 Posted February 9, 2009 Author Share Posted February 9, 2009 No, I don't think it's a short tag issue. I've enable short tags in php.ini, as well as tries just using regular <?php tags, doesn't seem to matter. Link to comment https://forums.phpfreaks.com/topic/144424-solved-treating-xml-file-as-php-htaccess-not-working/#findComment-757895 Share on other sites More sharing options...
ratcateme Posted February 9, 2009 Share Posted February 9, 2009 sorry silly me didn't see that umm try adding AddHandler php5-script .xml and dont use the AddType directive to your htaccess file also you should be able to find all the info you need in /etc/httpd/conf.d/php.conf on linux im not sure of the windows path Scott. Link to comment https://forums.phpfreaks.com/topic/144424-solved-treating-xml-file-as-php-htaccess-not-working/#findComment-757905 Share on other sites More sharing options...
neo926 Posted February 9, 2009 Author Share Posted February 9, 2009 That did the trick! That's fantastic, thank you very much! On a side note, would my problem have anything to do with whether my site is running php4 or php5? Right now it's running php4, but I believe I have the option to change to php5. Again, thanks a lot. Link to comment https://forums.phpfreaks.com/topic/144424-solved-treating-xml-file-as-php-htaccess-not-working/#findComment-757914 Share on other sites More sharing options...
ratcateme Posted February 9, 2009 Share Posted February 9, 2009 really most people developing in php are only using hosts with PHP5 as PHP4 is outdated and support for it has discontinued Scott. Link to comment https://forums.phpfreaks.com/topic/144424-solved-treating-xml-file-as-php-htaccess-not-working/#findComment-757919 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.