0

Zend フレームワークのデータベース接続に関連するものがあると、エラーが発生します。サーバーはApacheを実行しているUNIXサーバーです。

これが私の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 を記述しても問題ありませんか。

4

1 に答える 1

0

ErrorController.php を次の内容に置き換えます

<?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;
    }


}
于 2012-04-23T04:42:19.023 に答える