Zend_Feed: white screen of death on Production, works perfectly on Dev Server

450 Views Asked by At

A few weeks ago I noticed that the RSS feed on my live site was broken - I get a white screen of death. It had worked fine up until then. The rest of my site continues to work fine. Additionally the identical code continues to work perfectly on my dev box.

No code changes have occurred, so I'm guessing my web host have changed a server setting - but I've no idea what the setting may be (so I don't know if there's a workaround or if I need to ask my web host to change something). Both Prod & Dev are running PHP 5.3.8.

Could anyone give me a clue as to what that setting might be?

The only major difference I could see in the response headers was that my (non-working) Production RSS feed has this Response Header: "Accept-Ranges: none".

I've double-checked the DB call that populates the feed, and even replaced it with some static data within the class (just in case there was a DB problem), but it makes no difference.

Code for the relevant Controller method below:

    public function articlesAction(){
    $format = $this->_request->getParam('format');
    //default format to rss if unspecified
    $format = in_array($format, array('rss','atom')) ? $format : 'rss';

    $articles = new Application_Model_DbTable_Articles();
    $rows = $articles->getLatestArticlesForFeed();
        $channel = array(
            'title'         =>  'Feed of articles',
            'link'          =>  'http://www.mysite.co.uk',
            'description'   =>  'The latest articles and reviews from my site',
            'author'        =>  'My name',
            'language'      =>  'en',
            'ttl'           =>  '60',
            'copyright'     =>  '© the writers of the articles',
            'charset'       =>  'utf-8',
            'entries'       =>  array()
        );
        foreach ($rows as $item) {
            $articlelink = 'http://www.mysite.co.uk/articles/' . $item['stub'];
            $formattedlink = '<p><strong>Source: <a href="'.$articlelink.'">'.$articlelink.'</a></strong></p>';
            $channel['entries'][] = array(
                'title'         =>  $item['title'],
                'link'          =>  $articlelink,
                'guid'          =>  $articlelink,
                'description'   =>  $formattedlink . $item['content'] . '<p>© ' . $item['byline'] . ', ' . $item['copyright'] . '</p>' ,
                'lastUpdate'    =>  strtotime($item['date_published'])
            );
        }
        $feed = Zend_Feed::importArray($channel, $format);
        $feed->__wakeup();
    }
    $feed->send();
    $this->_helper->viewRenderer->setNoRender();
    $this->_helper->layout()->disableLayout();
}
1

There are 1 best solutions below

0
On

I wasted an hour once figuring out why I have a WSOD just because I initiated a class with one lowercase letter...

$table = new Model_DbTable_EshopSubcategories(); instead of

$table = new Model_DbTable_EshopSubCategories();

The dev server does not have to be case sensitive and the production server can.