Zend Framework and FireFox inconsistent crashes
Our site crashes intermittently in FireFox on loading/reloading a page. The site is built with Zend Framework 1.11.7. The problem is on our production server (shared hosting) and it only seems to happen using FireFox, all other browsers we could not replicate the problem. The development server works fine. The site has been validated except for we are using Adobe Strobe Media Player which has the usual validation errors.
When it crashes we usually see
Please contact the server administrator, [no address given] and inform them of the time the > error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
0 HTTP/1.1 200 OK Date: Sun, 19 Jun 2011 04:33:13 GMT Server: Apache/2.2.17 (Unix) > > >FrontPage/5.0.2.2635 X-Powered-By: PHP/5.2.17 Keep-Alive: timeout=5, max=99 Connection: Keep->Alive Transfer-Encoding: chunked Content-Type: text/html 38fd
The above message could be in the body, or the only content in the body along with the html source code. We have also seen the above message replace the Javascript/jQuery code.
Sometimes the site will load with no CSS, at other times with no Javascript (jQuery).
There are no errors in our server logs.
By the symptoms it seems that the bootstrap.php file is not loading properly.
We are using the default .htaccess and our bootstrap.php is
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
protected function _initView() {
$view = new Zend_View();
$view->doctype('XHTML1_TRANSITIONAL');
$view->headTitle(' News')
->setSeparator(' - ');
$view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8');
$view->headLink(array('rel' => 'shortcut icon',
'href' => '/css/images/favicon.ico'), 'PREPEND');
$view->headScript()->appendFile('/js/jquery-1.6.1.min.js')
->appendFile('/js/jquery-ui-1.8.13.custom.min.js')
->appendFile('/js/validate.js')
->appendFile('/js/bloom.js');
$view->headLink()->appendStylesheet('/css/main.css')
->appendStylesheet('/css/trontastic/jquery-ui-1.8.13.custom.css');
// Add it to the ViewRenderer
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
// Return it, so that it can be stored by the bootstrap
return $view;
}
protected function _initAutoload() {
// Add autoloader empty namespace
$autoLoader = Zend_Loader_Autoloader::getInstance();
$autoLoader->registerNamespace('BloomData_');
$resourceLoader = new Zend_Loader_Autoloader_Resource(a开发者_如何学Gorray(
'basePath' => APPLICATION_PATH,
'namespace' => '',
'resourceTypes' => array(
'form' => array(
'path' => 'forms/',
'namespace' => 'Form_',
),
'model' => array(
'path' => 'models/',
'namespace' => 'Model_'
),
),
));
// Return it so that it can be stored by the bootstrap
return $autoLoader;
}
protected function _initRoute() {
$ctrl = Zend_Controller_Front::getInstance();
$router = $ctrl->getRouter(); // returns a rewrite router by default
$ir = new Zend_Controller_Router_Route_Regex('id/(.*)',
array('controller' => 'index', 'action' => 'index'),
array(1 => 'id'));
$router->addRoute('idRoute', $ir);
$sr = new Zend_Controller_Router_Route_Regex('sector/(.*)/id/(.*)',
array('controller' => 'index', 'action' => 'index'),
array(1 => 'sector', 2 => 'id'));
$router->addRoute('sectorRoute', $sr);
$dr = new Zend_Controller_Router_Route_Regex('date/(.*)/id/(.*)',
array('controller' => 'index', 'action' => 'index'),
array(1 => 'date', 2 => 'id'));
$router->addRoute('dateRoute', $dr);
}
}
I do not think that it is a problem of Firefox or any other browser. It seems you do not set proper headers, that's why you get chunked content. Try to add in .htaccess these lines:
SetEnv force-response-1.0 1
SetEnv downgrade-1.0 1
Zend recommends using the latest PHP version. Try contacting your shard hosting provider and ask them to upgrade to the latest PHP 5.3 version. I had similar odd crashes that were resolved only by updating the php version.
Also confirm you're running the same zend framework version on your dev & production.
精彩评论