# Apache not reading RSS feeds correctly

## jsnaza

I hope you can help I am up against a wall. 

I am having a problem with Apache pulling RSS feeds correctly. I have always been able to use Joomla to pull RSS feeds with images and now when you view the site the images are not there and it is only displaying html. 

I believe I have narrowed it down to a problem with either Apache a module it almost looks like it is reading/parsing the data from the RSS feed incorrectly.

I recovered a working backup of the site to make sure that it was not the Joomla installation that was causing the problem.

Any help or ideas would be appreciated.

----------

## elgato319

I think this has nothing to do with apache.

Do you use php/joomla to get those rss feeds?

----------

## ianw1974

Also check it's not a combination of Firefox and Adblock-Plus since I find images on joomla sites can be blocked because of Adblock-Plus.

----------

## jsnaza

Yes, I use PHP/Joomla to get the feeds.

Would this be more of a PHP issue?

I do not use adblock plus and it will not work from home on FireFox or from work with IE6 or IE7.

----------

## elgato319

 *Quote:*   

> 
> 
> when you view the site the images are not there
> 
> 

 

are there no img tags in the html source? or are the paths not correct?

could you post a sample from the html source?

----------

## jsnaza

I believe the feeds are in the correct format I am thinking that PHP is not reading or outputting the RSS feeds correctly anymore. Is there something that I should have merged with PHP or Apache that handles RSS feeds? Would something I overlooked have changed in the PHP package?

I may be going the wrong direction with this too... I guess that is why I am asking for help   :Smile: 

Here is the actual RSS feed:

```

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>

<rss version="2.0"  >

  <channel>

    <title>Netflix Movies At Home</title>

    <ttl>30</ttl>

    <link>http://www.netflix.com/YourAccount</link>

    <description>Your Movies at Home</description>

    <language>en-us</language>

<cf:treatAs xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005">list</cf:treatAs>

    <item>

      <title>Batman Begins</title>

      <link>http://www.netflix.com/Movie/Batman_Begins/70021642</link>

      <guid isPermaLink="true">http://www.netflix.com/Movie/Batman_Begins/70021642</guid>

      <description>&lt;a href=&quot;http://www.netflix.com/Movie/Batman_Begins/70021642&quot;&gt;&lt;img src=&quot;http://cdn-0.nflximg.com/us/boxshots/small/70021642.jpg&quot;/&gt;&lt;/a&gt;&lt;br&gt;&lt;p&gt;Shipped on 10/03/08.&lt;/p&gt;

After training with a ninja (Ken Watanabe) in Asia following his parents' brutal murder, Bruce Wayne (Christian Bale) returns to Gotham City and finds it overrun with crime and corruption. Discovering a cave under Wayne Manor, Bruce assumes a new identity and wages a one-man war against the criminals that plague the city. Katie Holmes, Liam Neeson, Gary Oldman, Tom Wilkinson and Morgan Freeman co-star. Christopher Nolan directs.</description>

    </item>

    <item>

      <title>The Forbidden Kingdom</title>

      <link>http://www.netflix.com/Movie/The_Forbidden_Kingdom/70084795</link>

      <guid isPermaLink="true">http://www.netflix.com/Movie/The_Forbidden_Kingdom/70084795</guid>

      <description>&lt;a href=&quot;http://www.netflix.com/Movie/The_Forbidden_Kingdom/70084795&quot;&gt;&lt;img src=&quot;http://cdn-0.nflximg.com/us/boxshots/small/70084795.jpg&quot;/&gt;&lt;/a&gt;&lt;br&gt;&lt;p&gt;Shipped on 10/03/08.&lt;/p&gt;

Kung fu legends Jackie Chan and Jet Li star in this exciting adventure about a martial arts movie fanatic named Jason (Michael Angarano) who discovers a mystical Chinese staff in a local pawnshop that transports him to war-torn ancient China. When he learns that the staff belongs to the mighty Monkey King, who's been unjustly imprisoned by an evil warlord, Jason joins a group of skilled warriors to free the captive king and return the weapon.</description>

    </item>

  </channel>

</rss>

<!--

-->

```

Here is what my site displays:

```

         <ul class="newsfeedS1"  >

                     <li>

                           <a href="http://www.netflix.com/Movie/Batman_Begins/70021642" target="_child">

               Batman Begins</a>

                           <div class="newsfeed_itemS1"  >

                  a href=http://www.netflix.com/Movie/Batman_Begins/70021642img src=http://cdn-0.nflximg.com/us/boxshots/small/70021642.jpg//abrpShipped on 10/03/08./p

After training with a ninja (Ken Watanabe) in Asia following his parents' brutal murder, Bruce Wayne (Christian Bale) returns to Gotham City and finds it overrun with crime and corruption. Discovering a cave under Wayne Manor, Bruce assumes a new identity and wages a one-man war against the criminals that plague the city. Katie Holmes, Liam Neeson, Gary Oldman, Tom Wilkinson and Morgan Freeman co-star. Christopher Nolan directs.               </div>

                           </li>

                        <li>

                           <a href="http://www.netflix.com/Movie/The_Forbidden_Kingdom/70084795" target="_child">

               The Forbidden Kingdom</a>

                           <div class="newsfeed_itemS1"  >

                  a href=http://www.netflix.com/Movie/The_Forbidden_Kingdom/70084795img src=http://cdn-0.nflximg.com/us/boxshots/small/70084795.jpg//abrpShipped on 10/03/08./p

Kung fu legends Jackie Chan and Jet Li star in this exciting adventure about a martial arts movie fanatic named Jason (Michael Angarano) who discovers a mystical Chinese staff in a local pawnshop that transports him to war-torn ancient China. When he learns that the staff belongs to the mighty Monkey King, who's been unjustly imprisoned by an evil warlord, Jason joins a group of skilled warriors to free the captive king and return the weapon.               </div>

                           </li>

                     </ul>

```

----------

## elgato319

ok..

php itself doesn't intrepret rss feeds. there is always some script involved to parse the feed and display it.

in your case there is html code in the <description> section of the feed.

to maintain proper xml standards those need to be escaped

e.g.

'&' becomes '&amp;'

'<' becomes '&lt;'

...

now your website doesn't seem to convert those back to their original form. they are just left out.

when parsing the feed the script needs to convert them back to be displayed correctly.

you said you use joomla to display the feeds

maybe there is some upgrade to joomla for better handling rss feeds.

----------

## jsnaza

I did some looking and there is no update for Joomla I am running the newest version (1.5.7) and I am running (1.5.2) there are no RSS bugs reported for these versions. 

Then I attempted to find a simple script that would display and parse an RSS feed for me just to double check Joomla's script. I had a friend test it on his web server and this script worked correctly. I then copied the files to my server and the RSS feed is acting the exact same way my Joomla install is acting.

I was not able to run a backup of my site on his server because he does not have an SQL Server running or I would have tested my whole site.

I know that there is a separate script in each of these applications that parse the RSS feed but right now I am still wondering if they are not getting passed correct data.

If Apache and PHP are not making changes to the data I am not sure what is. Is it possible at all that PHP or Apache could be interpreting this data incorrectly or changing this data?

BTW: Thank you for all of your help so far.

----------

## merlin99

Believe it or not, I am having exactly the same problem with the Drupal Feed Aggregator.  I managed to isolate the problem to strange behavior in the php xml parser.  This is simple php test program:

```

function element_start($parser, $name, $attributes) {

  print "START ELEMENT ".$name."\n";

}

function element_end($parser, $name) {

  print "END ELEMENT ".$name."\n";

}

function element_data($parser,$data) {

  print "ELEMENT DATA: ".$data."\n";

}

/**

 * Test code

 */

$fp = fopen("php://stdin","r");

$data = stream_get_contents($fp);

$xml_parser = xml_parser_create("iso-8859-1");

xml_set_element_handler($xml_parser, 'element_start', 'element_end');

xml_set_character_data_handler($xml_parser, 'element_data');

print $data."\n";

xml_parse($xml_parser,$data,1);

xml_parser_free($xml_parser);

```

The program demonstrates that the xml parser is skipping the character entities.  For example, the input:

```

<hello>this&lt;is&gt;a test.</hello>

```

Produces the output:

```

<hello>this&lt;is&gt;a test.</hello>

START ELEMENT HELLO

ELEMENT DATA: this

ELEMENT DATA: is

ELEMENT DATA: a test.

END ELEMENT HELLO

```

This is clearly wrong, but I have no idea why.  It seems to work correctly for most people, so there must be something strange going on with my (and your) configuration.

----------

## jsnaza

It is good to  know that I am not the only one that is dealing with this I thought that I was going crazy. 

Thank you for your input and I am getting the same results from the code you posted so we must be having the exact same issue if you find a fix, please, please post it and if I do I will do the same.

This at least gives me a better place to start looking for answers.

----------

## merlin99

This issue as described by php bug #45996 is that the way php uses the expat style parsing routines does not work correctly with the more recent versions of libxml2.  The suggested workaround in to build php with libexpat instead of libxml2.  I was just looking at the php ebuild and I have no idea how to do this.

----------

## jsnaza

I have not found much support regarding the install of the expat library in Gentoo. It looks pretty well depreciated and I don't feel comfortable installing it with out emerge's help because I think it may cause more problems in the long run than it would be worth. 

I wonder if it would be more helpful to start a new thread requesting help on the installation of the expat library.

or 

Just practice some patience I have had this problem for this long and it looks like some effort is being made by PHP to fix the issue.

----------

