mysql - Undefinable problem with my Zend Framework based site -
lately had reinstall development site on ubuntu machine since system crashed after os update. 4 days later site still not running should. whenever action has in action on database, stops working.
for example when registring new user, following error:
[sun jul 25 20:07:20 2010] [error] [client 127.0.0.1] php notice: trying property of non-object in /var/www/nrka2/application/bootstrap/bootstrap.php on line 169, referer: http://nrka2/user/register [sun jul 25 20:07:20 2010] [error] [client 127.0.0.1] php stack trace:, referer: http://nrka2/user/register [sun jul 25 20:07:20 2010] [error] [client 127.0.0.1] php 1. {main}() /var/www/nrka2/public/index.php:0, referer: http://nrka2/user/register [sun jul 25 20:07:20 2010] [error] [client 127.0.0.1] php 2. require() /var/www/nrka2/public/index.php:2, referer: http://nrka2/user/register [sun jul 25 20:07:20 2010] [error] [client 127.0.0.1] php 3. zend_application->bootstrap() /var/www/nrka2/application/application.php:23, referer: http://nrka2/user/register [sun jul 25 20:07:20 2010] [error] [client 127.0.0.1] php 4. zend_application_bootstrap_bootstrapabstract->bootstrap() /var/www/zend/zendframework-1.10.6/library/zend/application.php:355, referer: http://nrka2/user/register [sun jul 25 20:07:20 2010] [error] [client 127.0.0.1] php 5. zend_application_bootstrap_bootstrapabstract->_bootstrap() /var/www/zend/zendframework-1.10.6/library/zend/application/bootstrap/bootstrapabstract.php:583, referer: http://nrka2/user/register [sun jul 25 20:07:20 2010] [error] [client 127.0.0.1] php 6. zend_application_bootstrap_bootstrapabstract->_executeresource() /var/www/zend/zendframework-1.10.6/library/zend/application/bootstrap/bootstrapabstract.php:619, referer: http://nrka2/user/register [sun jul 25 20:07:20 2010] [error] [client 127.0.0.1] php 7. bootstrap->_initviewsettings() /var/www/zend/zendframework-1.10.6/library/zend/application/bootstrap/bootstrapabstract.php:666, referer: http://nrka2/user/register [sun jul 25 20:07:22 2010] [error] [client 127.0.0.1] php notice: trying property of non-object in /var/www/nrka2/application/bootstrap/bootstrap.php on line 169, referer: http://nrka2/css/main.css [sun jul 25 20:07:22 2010] [error] [client 127.0.0.1] php stack trace:, referer: http://nrka2/css/main.css [sun jul 25 20:07:22 2010] [error] [client 127.0.0.1] php 1. {main}() /var/www/nrka2/public/index.php:0, referer: http://nrka2/css/main.css [sun jul 25 20:07:22 2010] [error] [client 127.0.0.1] php 2. require() /var/www/nrka2/public/index.php:2, referer: http://nrka2/css/main.css [sun jul 25 20:07:22 2010] [error] [client 127.0.0.1] php 3. zend_application->bootstrap() /var/www/nrka2/application/application.php:23, referer: http://nrka2/css/main.css [sun jul 25 20:07:22 2010] [error] [client 127.0.0.1] php 4. zend_application_bootstrap_bootstrapabstract->bootstrap() /var/www/zend/zendframework-1.10.6/library/zend/application.php:355, referer: http://nrka2/css/main.css [sun jul 25 20:07:22 2010] [error] [client 127.0.0.1] php 5. zend_application_bootstrap_bootstrapabstract->_bootstrap() /var/www/zend/zendframework-1.10.6/library/zend/application/bootstrap/bootstrapabstract.php:583, referer: http://nrka2/css/main.css [sun jul 25 20:07:22 2010] [error] [client 127.0.0.1] php 6. zend_application_bootstrap_bootstrapabstract->_executeresource() /var/www/zend/zendframework-1.10.6/library/zend/application/bootstrap/bootstrapabstract.php:619, referer: http://nrka2/css/main.css [sun jul 25 20:07:22 2010] [error] [client 127.0.0.1] php 7. bootstrap->_initviewsettings() /var/www/zend/zendframework-1.10.6/library/zend/application/bootstrap/bootstrapabstract.php:666, referer: http://nrka2/css/main.css
my bootstrap class looks this:
<?php class bootstrap extends zend_application_bootstrap_bootstrap{ /** * * @var unknown_type */ public $frontcontroller; /** * * @var unknown_type */ protected $_logger; /** * * @var unknown_type */ protected $_acl; /** * * @var unknown_type */ protected $_auth; /** * setup logging */ protected function _initlogging() { $this->bootstrap('frontcontroller'); $logger = new zend_log(); $writer = 'production' == $this->getenvironment() ? new zend_log_writer_stream(application_path . '/../data/logs/app.log') : new zend_log_writer_firebug(); $logger->addwriter($writer); if ('production' == $this->getenvironment()) { $filter = new zend_log_filter_priority(zend_log::crit); $logger->addfilter($filter); } $this->_logger = $logger; zend_registry::set('log', $logger); } protected function _initdefaultmoduleautoloader(){ $this->_logger->info('bootstrap '. __method__); $this->_resourceloader = new zend_application_module_autoloader(array( 'namespace' => 'eventmanager', 'basepath' => application_path . '/modules/eventmanager', )); $this->_resourceloader->addresourcetypes(array( 'modelresource' => array( 'path' => 'models/resources', 'namespace' => 'resource', ), 'service' => array( 'path' => 'services', 'namespace' => 'service' ), )); } // @todo develop function protected function _initdbprofiler(){ $this->_logger->info('bootstrap ' . __method__); if ('production' !== $this->getenvironment()) { $this->bootstrap('db'); $profiler = new zend_db_profiler_firebug('all db queries'); $profiler->setenabled(true); $this->getpluginresource('db')->getdbadapter()->setprofiler($profiler); } } /** * add controller action helpers */ protected function _initactionhelpers() { $this->_logger->info('bootstrap ' . __method__); zend_controller_action_helperbroker::addhelper(new sf_controller_helper_acl()); zend_controller_action_helperbroker::addhelper(new sf_controller_helper_redirectcommon()); zend_controller_action_helperbroker::addhelper(new sf_controller_helper_service()); } /** * * @return unknown_type */ protected function _initroutes(){ $this->_logger->info('initialize routes '. __method__); $this->bootstrap('frontcontroller'); $router = $this->frontcontroller->getrouter(); $route = new zend_controller_router_route( 'register', array( 'controller' => 'user', 'action' => 'register' ) ); $router->addroute('register',$route); $route = new zend_controller_router_route( 'login', array( 'controller' => 'user', 'action' => 'login' ) ); $router->addroute('login',$route); $route = new zend_controller_router_route( 'logout', array( 'controller' => 'user', 'action' => 'logout' ) ); $router->addroute('logout',$route); } /** * * @return void */ protected function _initlocale(){ $this->_logger->info('bootstrap '.__method__); $locale = new zend_locale('nl_nl'); zend_registry::set('zend_locale', $locale); } protected function _initacl(){ $this->_acl = new eventmanager_service_acl(); } /** * * @return void */ protected function _initviewsettings(){ $this->_logger->info('bootstrap '.__method__); $this->bootstrap('view'); $this->bootstrap('acl'); $this->_view = $this->getresource('view'); //set encoding , doctype $this->_view->setencoding('utf-8'); $this->_view->doctype('xhtml1_strict'); $this->_view->headmeta()->appendhttpequiv('content-type', 'text/html; charset=utf-8'); $this->_view->headmeta()->appendhttpequiv('content-language', 'en-us'); //@todo op een later moment moeten hier nog de stylesheets worden toegevoegd $this->_view->headlink()->appendstylesheet('/css/main.css'); //$this->_view->headtitle('event manager'); /* set head style. $this->_view->headtitle->headstyle(); */ $this->_view->headtitle()->setseparator(' - '); $this->_auth = zend_auth::getinstance(); $navigation = new zend_config_xml(application_path.'/configs/navigation.xml','nav'); $navcontainer = new zend_navigation($navigation); $this->_view->navigation($navcontainer)->setacl($this->_acl)->setrole($this->_auth->getstorage()->read()->usr_role); //this line 169!!!!!!!!! } /** * add graceful error handling dispatch, handle * errors during front controller dispatch. */ public function run() { $errorhandling = $this->getoption('errorhandling'); try { parent::run(); } catch(exception $e) { if (true == (bool) $errorhandling['graceful']) { $this->__handleerrors($e, $errorhandling['email']); } else { throw $e; } } } /** * handle errors gracefully, work long views, * , zend classes available * * @param exception $e * @param string $email */ protected function __handleerrors(exception $e, $email) { header('http/1.1 500 internal server error'); $view = new zend_view(); $view->addscriptpath(dirname(__file__) . '/../views/scripts'); echo $view->render('fatalerror.phtml'); if ('' != $email) { $mail = new zend_mail(); $mail->setsubject('fatal error in application storefront'); $mail->addto($email); $mail->setbodytext( $e->getfile() . "\n" . $e->getmessage() . "\n" . $e->gettraceasstring() . "\n" ); @$mail->send(); } } }
i have tried debug code, everyting goes until somethign db. don't know goes wrong db. don't clear error messages. can me?
some more possible interesting data:
[bootstrap] resources.db.adapter = "pdo_mysql" resources.db.isdefaulttableadapter = true resources.db.params.dbname = "ladosa" resources.db.params.username = "root" resources.db.params.password = "root" resources.db.params.hostname = "localhost" resources.db.params.charset = "utf8" resources.db.params.profiler.enabled = true resources.db.params.profiler.class = zend_db_profiler_firebug autoloadernamespaces[] = "zend_" autoloadernamespaces[] = "sf_" phpsettings.display_errors = 0 phpsettings.error_reporting = 8191 phpsettings.date.timezone = "europe/amsterdam" bootstrap.path = application_path"/bootstrap/bootstrap.php" pluginpaths.resource_ = application_path"/resources" resources.frontcontroller.moduledirectory = application_path"/modules" resources.frontcontroller.defaultmodule = "eventmanager" resources.frontcontroller.params.prefixdefaultmodule = true resources.frontcontroller.exceptions = false resources.view[] = "" resources.layout.layoutpath = application_path "/layouts/scripts" resources.view.encoding = "utf-8" resources.view.title = rode kruis vrijwilligers applicatie ;resources.view.helperpath.default_view_helper = application_path "/modules/eventmanager/views/helpers" resources.layout.layout = "main" [production:bootstrap] [development:bootstrap] ;resources.frontcontroller.throwexceptions = 1 ;phpsettings.display_startup_errors=1 ;phpsettings.display_errors = 1 ;resources.frontcontroller.throwerrors = [test:production]
btw. can login database command line given username , password.
update: today decided investigate on http request , came error 500. apache logs don't give related information, think. posted logs above.
any idea's?
i'm not familiar zend, may off in left field. looking @ line, , properties accessed, looks that
$this->_auth->getstorage()->read()
is not returning object want, usr_role
property can't accessed. test, maybe var_dump
bit before line 169 , see happens...
could getstorage
or read
implementation uses storage mechanism requires specific configuration? maybe sessions, memcached, or file permissions?
Comments
Post a Comment