`
duoerbasilu
  • 浏览: 1542508 次
文章分类
社区版块
存档分类
最新评论

zend framework Bootstrap.php数据库适配器配置及错误解决

 
阅读更多
( ! ) Zend_Config_Exception: parse_ini_file(F:\xampp\htdocs\zendfrm\application\application.ini) [function.parse-ini-file]: failed to open stream: No such file or directory in F:\xampp\htdocs\zendfrm\library\Zend\Config\Ini.php on line 182 Call Stack #TimeMemoryFunctionLocation 10.0030340224{main}( )..\index.php:0 20.0048434800Zend_Application->__construct( string(11), string(59) )..\index.php:24 30.0098781416Zend_Application->setOptions( array(5) )..\Application.php:92 40.0099782672Zend_Application->setBootstrap( string(49), string(9) )..\Application.php:184 50.01361026872Bootstrap->__construct( object(Zend_Application)[1] )..\Application.php:325 60.02261345440Zend_Config_Ini->__construct( string(51), string(5), ??? )..\Bootstrap.php:13 70.02261345472Zend_Config_Ini->_loadIniFile( string(51) )..\Ini.php:126 80.02261345472Zend_Config_Ini->_parseIniFile( string(51) )..\Ini.php:202

( ! ) Fatal error: Uncaught exception 'Zend_Config_Exception' with message 'parse_ini_file(F:\xampp\htdocs\zendfrm\application\application.ini) [function.parse-ini-file]: failed to open stream: No such file or directory' in F:\xampp\htdocs\zendfrm\library\Zend\Config\Ini.php on line 182

( ! ) Zend_Config_Exception: parse_ini_file(F:\xampp\htdocs\zendfrm\application\application.ini) [function.parse-ini-file]: failed to open stream: No such file or directory in F:\xampp\htdocs\zendfrm\library\Zend\Config\Ini.php on line 182

Call Stack

#

Time

Memory

Function

Location

1

0.0030

340224

{main}( )

..\index.php:0

2

0.0048

434800

Zend_Application->__construct( string(11), string(59) )

..\index.php:24

3

0.0098

781416

Zend_Application->setOptions( array(5) )

..\Application.php:92

4

0.0099

782672

Zend_Application->setBootstrap( string(49), string(9) )

..\Application.php:184

5

0.0136

1026872

Bootstrap->__construct( object(Zend_Application)[1] )

..\Application.php:325

6

0.0226

1345440

Zend_Config_Ini->__construct( string(51), string(5), ??? )

..\Bootstrap.php:13

7

0.0226

1345472

Zend_Config_Ini->_loadIniFile( string(51) )

..\Ini.php:126

8

0.0226

1345472

Zend_Config_Ini->_parseIniFile( string(51) )

..\Ini.php:202

路径错误和路径分隔符错误:

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
//启动
function __construct($app){
parent::__construct($app);
file_put_contents("d:/mylog.txt", __FILE__.date('y-m-d h:i:s')."\r\n",FILE_APPEND);


//初始化我们的数据库适配器
$url=constant("APPLICATION_PATH").DIRECTORY_SEPARATOR.'configs'.DIRECTORY_SEPARATOR.'application.ini';
$dbconfig=new Zend_Config_Ini($url,"mysql");
$db=Zend_Db::factory($dbconfig->db);
$db->query('SET NAMES UTF8');
Zend_Db_Table::setDefaultAdapter($db);
}

}

ok..............................................................................................................................................

i am harry

Welcome to the Zend Framework!

This is your project's main page

Zend_Db_Table_Rowset Object
(
    [_data:protected] => Array
        (
            [0] => Array
                (
                    [message_id] => 1
                    [sender] => 张三
                    [getter] => 李海
                    [sendtime] => 2012-07-19 14:01:33
                    [content] => 你好啊,还在吗?
                )

            [1] => Array
                (
                    [message_id] => 2
                    [sender] => 李四
                    [getter] => 张国荣
                    [sendtime] => 2012-07-09 14:02:18
                    [content] => 风继续吹
                )

            [2] => Array
                (
                    [message_id] => 3
                    [sender] => 回音哥
                    [getter] => 郭德纲
                    [sendtime] => 2012-07-26 14:02:39
                    [content] => 我的歌声里
                )

            [3] => Array
                (
                    [message_id] => 4
                    [sender] => 李逍遥
                    [getter] => 大s
                    [sendtime] => 2012-07-26 14:03:25
                    [content] => 真漂亮
                )

            [4] => Array
                (
                    [message_id] => 5
                    [sender] => 张柏芝
                    [getter] => 谢霆锋
                    [sendtime] => 2012-07-27 14:04:39
                    [content] => 原谅我吧
                )

            [5] => Array
                (
                    [message_id] => 6
                    [sender] => 周立波
                    [getter] => 周瑾
                    [sendtime] => 2012-07-30 14:05:13
                    [content] => 你不和我搭档了吗?
                )

            [6] => Array
                (
                    [message_id] => 7
                    [sender] => 李云龙
                    [getter] => 刘少奇
                    [sendtime] => 2012-07-17 14:07:08
                    [content] => 我是华野的
                )

            [7] => Array
                (
                    [message_id] => 8
                    [sender] => 毛总东
                    [getter] => 
                    [sendtime] => 2012-07-25 14:07:40
                    [content] => 全心全意为人民服务
                )

            [8] => Array
                (
                    [message_id] => 9
                    [sender] => 
                    [getter] => 
                    [sendtime] => 2012-07-25 14:08:10
                    [content] => 发展是硬道理
                )

        )

    [_table:protected] => Message Object
        (
            [_name:protected] => message
            [_primary:protected] => Array
                (
                    [1] => message_id
                )

            [_definition:protected] => 
            [_definitionConfigName:protected] => 
            [_db:protected] => Zend_Db_Adapter_Pdo_Mysql Object
                (
                    [_pdoType:protected] => mysql
                    [_numericDataTypes:protected] => Array
                        (
                            [0] => 0
                            [1] => 1
                            [2] => 2
                            [INT] => 0
                            [INTEGER] => 0
                            [MEDIUMINT] => 0
                            [SMALLINT] => 0
                            [TINYINT] => 0
                            [BIGINT] => 1
                            [SERIAL] => 1
                            [DEC] => 2
                            [DECIMAL] => 2
                            [DOUBLE] => 2
                            [DOUBLE PRECISION] => 2
                            [FIXED] => 2
                            [FLOAT] => 2
                        )

                    [_defaultStmtClass:protected] => Zend_Db_Statement_Pdo
                    [_config:protected] => Array
                        (
                            [host] => localhost
                            [username] => root
                            [password] => root
                            [dbname] => testzf
                            [charset] => 
                            [persistent] => 
                            [options] => Array
                                (
                                    [caseFolding] => 0
                                    [autoQuoteIdentifiers] => 1
                                    [fetchMode] => 2
                                )

                            [driver_options] => Array
                                (
                                )

                        )

                    [_fetchMode:protected] => 2
                    [_profiler:protected] => Zend_Db_Profiler Object
                        (
                            [_queryProfiles:protected] => Array
                                (
                                )

                            [_enabled:protected] => 
                            [_filterElapsedSecs:protected] => 
                            [_filterTypes:protected] => 
                        )

                    [_defaultProfilerClass:protected] => Zend_Db_Profiler
                    [_connection:protected] => PDO Object
                        (
                        )

                    [_caseFolding:protected] => 0
                    [_autoQuoteIdentifiers:protected] => 1
                    [_allowSerialization:protected] => 1
                    [_autoReconnectOnUnserialize:protected] => 
                )

            [_schema:protected] => 
            [_cols:protected] => Array
                (
                    [0] => message_id
                    [1] => sender
                    [2] => getter
                    [3] => sendtime
                    [4] => content
                )

            [_identity:protected] => 1
            [_sequence:protected] => 1
            [_metadata:protected] => Array
                (
                    [message_id] => Array
                        (
                            [SCHEMA_NAME] => 
                            [TABLE_NAME] => message
                            [COLUMN_NAME] => message_id
                            [COLUMN_POSITION] => 1
                            [DATA_TYPE] => int
                            [DEFAULT] => 
                            [NULLABLE] => 
                            [LENGTH] => 
                            [SCALE] => 
                            [PRECISION] => 
                            [UNSIGNED] => 1
                            [PRIMARY] => 1
                            [PRIMARY_POSITION] => 1
                            [IDENTITY] => 1
                        )

                    [sender] => Array
                        (
                            [SCHEMA_NAME] => 
                            [TABLE_NAME] => message
                            [COLUMN_NAME] => sender
                            [COLUMN_POSITION] => 2
                            [DATA_TYPE] => varchar
                            [DEFAULT] => 
                            [NULLABLE] => 
                            [LENGTH] => 64
                            [SCALE] => 
                            [PRECISION] => 
                            [UNSIGNED] => 
                            [PRIMARY] => 
                            [PRIMARY_POSITION] => 
                            [IDENTITY] => 
                        )

                    [getter] => Array
                        (
                            [SCHEMA_NAME] => 
                            [TABLE_NAME] => message
                            [COLUMN_NAME] => getter
                            [COLUMN_POSITION] => 3
                            [DATA_TYPE] => varchar
                            [DEFAULT] => 
                            [NULLABLE] => 
                            [LENGTH] => 64
                            [SCALE] => 
                            [PRECISION] => 
                            [UNSIGNED] => 
                            [PRIMARY] => 
                            [PRIMARY_POSITION] => 
                            [IDENTITY] => 
                        )

                    [sendtime] => Array
                        (
                            [SCHEMA_NAME] => 
                            [TABLE_NAME] => message
                            [COLUMN_NAME] => sendtime
                            [COLUMN_POSITION] => 4
                            [DATA_TYPE] => datetime
                            [DEFAULT] => 
                            [NULLABLE] => 
                            [LENGTH] => 
                            [SCALE] => 
                            [PRECISION] => 
                            [UNSIGNED] => 
                            [PRIMARY] => 
                            [PRIMARY_POSITION] => 
                            [IDENTITY] => 
                        )

                    [content] => Array
                        (
                            [SCHEMA_NAME] => 
                            [TABLE_NAME] => message
                            [COLUMN_NAME] => content
                            [COLUMN_POSITION] => 5
                            [DATA_TYPE] => varchar
                            [DEFAULT] => 
                            [NULLABLE] => 
                            [LENGTH] => 2000
                            [SCALE] => 
                            [PRECISION] => 
                            [UNSIGNED] => 
                            [PRIMARY] => 
                            [PRIMARY_POSITION] => 
                            [IDENTITY] => 
                        )

                )

            [_metadataCache:protected] => 
            [_metadataCacheInClass:protected] => 1
            [_rowClass:protected] => Zend_Db_Table_Row
            [_rowsetClass:protected] => Zend_Db_Table_Rowset
            [_referenceMap:protected] => Array
                (
                )

            [_dependentTables:protected] => Array
                (
                )

            [_defaultSource:protected] => defaultNone
            [_defaultValues:protected] => Array
                (
                )

        )

    [_connected:protected] => 1
    [_tableClass:protected] => Message
    [_rowClass:protected] => Zend_Db_Table_Row
    [_pointer:protected] => 0
    [_count:protected] => 9
    [_rows:protected] => Array
        (
        )

    [_stored:protected] => 1
    [_readOnly:protected] => 
)

分享到:
评论

相关推荐

    ZendFramework中文文档

    1. Introduction to Zend Framework 1.1. 概述 1.2. 安装 2. Zend_Acl 2.1. 简介 2.1.1. 关于资源(Resource) 2.1.2. 关于角色(Role) 2.1.3. 创建访问控制列表(ACL) 2.1.4. 注册角色(Role) 2.1.5. 定义访问...

    Zend Framework教程之配置文件application.ini解析

    这样做可以使得框架在加载类文件时能够使用正确的命名空间,减少配置错误。 5. 自定义命名空间和自动加载 Zend Framework支持在application.ini中定义自定义命名空间以及对应的自动加载规则。例如,...

    Zend+Auth入门教程v0[1].01.pdf

    1. **配置`Zend_Auth`**:在`Bootstrap`类中初始化`Zend_Auth`,设置认证适配器,如数据库适配器(`Zend_Auth_Adapter_DbTable`),并指定数据库连接和用户表的相关信息。 2. **登录操作**:在登录控制器动作中,使用...

    zf1-registry:ZF1中的注册表组件

    在大型应用中,通常会在Bootstrap文件中初始化`Zend_Registry`,并将关键服务和配置对象存入其中。这样,其他组件在需要时可以无痛地访问这些资源,而无需关心它们是如何被创建和管理的。 **5. 注册表的优点** - **...

Global site tag (gtag.js) - Google Analytics