简体   繁体   English

配置Zend Framework 1.12 application.ini时出错

[英]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. 我正在做一个简单的网站,必须使用数据库中的某些表并执行一些Web服务任务。 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: 应用程序ini如下:

[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): 好吧,在这段漫长的代码粘贴之后,我有错误要显示给您,这对我来说没有任何意义,但我想像我正在做些事情(我不花很多时间使用zend framework,所以很明显我上午):

 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. 有时,偶然发生的情况是::在前面或后面有不间断的空格U + 00A0,然后Zend Framework崩溃了。 For example, on OSX pressing alt+space will insert a non breaking space and you won't notice it. 例如,在OSX上,按alt + space会插入一个不间断的空格,您不会注意到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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