2012-04-23 14 views
0

zend frameworkのデータベース接続に何か関係があるときにエラーが発生します。サーバーはApacheを実行しているUNIXサーバーです。ここでzend frameworkのデータベース設定

は私のapplication.ini設定

resources.db.adapter = "pdo_mysql"

resources.db.params.host = "localhost"

resources.db.params.username = "a5633138_hotel"

resources.db.params.password = "passowrd"

resources.db.params.dbname = "a5633138_hotel"

です

resources.db.isDefaultTableAdapter = true

ライブサーバーの場合は別の設定が必要ですか?たとえば、ホスト部分にlocalhostと書いても問題ありません。

+0

エラーをwathsであなたのErrorController.phpにを置き換えますか? –

+0

'未知の変数:/home/a5633138/public_html/application/controllers/ErrorController.php on line 33'と'致命的なエラー:/ home/a5633138の非オブジェクトのメンバー関数log()を呼び出してください。 /public_html/application/controllers/ErrorController.php on line 34' – Akrambek

+0

これは、データベースに接続する必要があるページでのみ発生します。 – Akrambek

答えて

0

次のような内容

<?php 

class ErrorController extends Zend_Controller_Action 
{ 

    public function errorAction() 
    { 
     $this->_helper->layout()->disableLayout(); 
     $errors = $this->_getParam('error_handler'); 

     if (!$errors || !$errors instanceof ArrayObject) { 
      $this->view->message = 'You have reached the error page'; 
      return; 
     } 

     switch ($errors->type) { 
      case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE: 
      case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: 
      case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: 
       // 404 error -- controller or action not found 
       $this->getResponse()->setHttpResponseCode(404); 
       $priority = Zend_Log::NOTICE; 
       $this->view->message = 'Page not found'; 
       break; 
      default: 
       // application error 
       $this->getResponse()->setHttpResponseCode(500); 
       $priority = Zend_Log::CRIT; 
       $this->view->message = 'Application error'; 
       break; 
     } 

     // Log exception, if logger available 
     $log = $this->getLog(); 
     if ($log) { 
      $log->log($this->view->message, $priority, $errors->exception); 
      $log->log('Request Parameters', $priority, $errors->request->getParams()); 
     } 

     // conditionally display exceptions 
     if ($this->getInvokeArg('displayExceptions') == true) { 
      $this->view->exception = $errors->exception; 
     } 

     $this->view->request = $errors->request; 
    } 

    public function getLog() 
    { 
     $bootstrap = $this->getInvokeArg('bootstrap'); 
     if (!$bootstrap->hasResource('Log')) { 
      return false; 
     } 
     $log = $bootstrap->getResource('Log'); 
     return $log; 
    } 


} 
+0

「メッセージ:SQLSTATE [28000] [1045]ユーザー 'a5633138_hotel' @ 'localhost'(パスワードは:YES)のアクセスが拒否されました ' – Akrambek

+0

しかし、問題は同じログインとパスワードを使用していることです。 phpmyadminでは面白いです。 – Akrambek

+0

@AkramYakubovパスワードのスペルが間違っています。「passowrd」は意図的なものかもしれません。 –

関連する問題