简体   繁体   中英

Error in configuration Zend Framework 1.12 application.ini

i'm making a simple website which have to use some table from a db and to perform some webservice task. Nothing complicated. I've taken the configuration from other projects in my root folder and pasted them in the configuration, and bootstrap files. The application ini is the following:

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
phpSettings.date.timezone = "Europe/Rome"
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
includePaths.library = APPLICATION_PATH "/../library"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

;connessione al db
resources.db.adapter = pdo_mssql
resources.db.params.host = "IP"
resources.db.params.username = USER
resources.db.params.password = PWD
resources.db.params.dbname = NAME
resources.db.isDefaultTableAdapter = true
resources.db.params.pdoType = dblib

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
;resources.db.adapter = pdo_mssql

My bootstrap file is the following:

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    public function _initAutoloader(){
        Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);
    }

    public function _initDb(){

        $resource = $this->getPluginResource("db");
        $db = $resource->getDbAdapter();
        $db->setFetchMode(Zend_Db::FETCH_OBJ);

        Zend_Db_Table_Abstract::setDefaultAdapter($db);
        Zend_Registry::set("db", $db);
    }
}

In my controller i'm doing the following operation (which were working when i was not connecting to the db):

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        $access_token=$this->getFrontController()->getRequest()->getHeader('Authorization');
        if(isset($access_token)){
            $access_token = str_replace ( "Bearer ", "", $access_token);
            $db=Zend_Registry::get("db");
            $token= $db->fetchRow("SELECT * FROM dbo.wsoauth2 WHERE atoken='".$access_token."'");
            if($token!=false){
                //Perform the action required to enter the right app
                $link= $db->fetchRow("SELECT * FROM dbo.wsapp WHERE appid='".$token->app_id);
                header("Authorization: Bearer ".$access_token);
                header("Location: ".$this->getFrontController()->getBaseUrl()."/webservice");
            } else {
                //Let the other stuff from the controller take place
            }
        }
   }

    public function indexAction()
    {
        $appid = $this->getRequest()->getParam('appid');
        $this->view->appid= $appid;
     }
}

Well after this long code paste i have the error to show to you, which deosn't make any sense to me but i immagine that i'm sissing something (i don't use zend framework from much time so it is obvious that i am):

 Fatal error: Uncaught exception 'Zend_Config_Exception' with message 'Section 'development' cannot be found in /usr/local/zend/apache2/htdocs/project/application/configs/application.ini'

The section "development" is in front of your eyes in the first code paste.. So i'm quite confused. Can anyone help?

Delete and add the spaces again in [development : production]

Sometimes it happens by accident that a non breaking space U+00A0 is in front or after the : and then Zend Framework goes nuts. For example, on OSX pressing alt+space will insert a non breaking space and you won't notice it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM