Zend_Feed:生产时白屏死机,在开发服务器上完美运行
几周前,我注意到我的实时网站上的 RSS 提要被破坏了 - 我看到了白屏死机。在那之前它一直运行良好。我网站的其余部分继续正常工作。此外,相同的代码在我的开发盒上仍然可以完美运行。
没有发生代码更改,所以我猜测我的网络主机已更改服务器设置 - 但我不知道该设置可能是什么(所以我不知道是否有解决方法,或者我是否需要询问我的网络主机更改某些内容)。两者产品和开发人员正在运行 PHP 5.3.8。
谁能告诉我那个设置可能是什么?
我在响应标头中看到的唯一主要区别是我的(非工作)生产 RSS 提要具有以下响应标头:“Accept-Ranges:none”。
我已经仔细检查了填充提要的数据库调用,甚至将其替换为类中的一些静态数据(以防万一出现数据库问题),但这没有什么区别。
相关Controller方法的代码如下:
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();
}
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();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一次我浪费了一个小时来弄清楚为什么我有 WSOD 只是因为我用一个小写字母启动了一堂课...
$table = new Model_DbTable_EshopSubcategories();而不是
$table = new Model_DbTable_EshopSubCategories();
开发服务器不必区分大小写,而生产服务器可以。
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.