codeigniter和数据库不起作用

时间:2013-06-03 04:19:57

标签: php codeigniter-2

我没有使用Tsodeigniter,但现在有一个工作网站是另一个托管。一旦你运行它,你得到这个:address : 95.87.255.162只是等待,没有任何东西在Apache日志文件中加载。我的设置配置文件是:

$ Active_group = 'default';
$ Active_record = TRUE;

$ Db ['default'] ['hostname'] = 'localhost';
$ Db ['default'] ['username'] = 'MYUSER';
$ Db ['default'] ['password'] = 'MYPASS';
$ Db ['default'] ['database'] = 'MYDATABASE';
$ Db ['default'] ['dbdriver'] = 'mysqli';
$ Db ['default'] ['dbprefix'] ='';
$ Db ['default'] ['pconnect'] = FALSE;
$ Db ['default'] ['db_debug'] = FALSE;
$ Db ['default'] ['cache_on'] = FALSE;
$ Db ['default'] ['cachedir'] ='';
$ Db ['default'] ['char_set'] = 'utf8';
$ Db ['default'] ['dbcollat'] = 'utf8_general_ci';
$ Db ['default'] ['swap_pre'] ='';
$ Db ['default'] ['autoinit'] = TRUE;
$ Db ['default'] ['stricton'] = FALSE;

(MYUSER, MADATABASE, MYPASS)是真实的。但是,如果错误的某些内容是网站加载但只有启动和其他静态页面,那些在数据库中记录为“页面”的那些不会打开,给出404.在错误的数据到基础并更改  $ db ['default'] ['db_debug'] = TRUE;

给出错误:

Error reading the database.
Unable to connect to your database server using the provided settings.
Filename: core / Loader.php
Line Number: 268

如果(MYUSER,MADATABASE,MYPASS)正确并将localhost更改为127.0.0.1,也会发生同样的情况。 由于我在error_logaccess_log中没有写任何内容,只能获得:

xxx.xxx.xxx.xxx - [03/Jun/2013: 07:01:03 0300] "GET / en / home HTTP/1.1" 200 -
My system is centos, php 5.1.6 mysql 5.1, codeigniter 2.0.3

2 个答案:

答案 0 :(得分:0)

codeigniter 2.0.3,尝试将mysql驱动程序从mysqli更改为mysql。在你的数据库配置中,将debug设置为true也看看会发生什么,并在application / logs / {date}中打开你的codeigniter日志文件.php

我不知道这是不是一个bug或者因为我之前遇到过这个问题,当使用mysqli驱动程序配置我的网站时网站运行缓慢。我还没有在公共托管中测试过。

答案 1 :(得分:0)

我的/ application / log / {date}中的

来自DEBUG:

DEBUG - 2013-06-03 21:21:30 --> Config Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Hooks Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Utf8 Class Initialized
DEBUG - 2013-06-03 21:21:30 --> UTF-8 Support Enabled
DEBUG - 2013-06-03 21:21:30 --> URI Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Router Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Output Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Security Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Input Class Initialized
DEBUG - 2013-06-03 21:21:30 --> CRSF cookie Set
DEBUG - 2013-06-03 21:21:30 --> Global POST and COOKIE data sanitized
DEBUG - 2013-06-03 21:21:30 --> Language Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Config file loaded: ../application/config/lang.php
DEBUG - 2013-06-03 21:21:30 --> Loader Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Config file loaded: ../application/config/machina.php
DEBUG - 2013-06-03 21:21:30 --> Helper loaded: common_helper
DEBUG - 2013-06-03 21:21:30 --> Helper loaded: url_helper
DEBUG - 2013-06-03 21:21:30 --> Helper loaded: form_helper
DEBUG - 2013-06-03 21:21:30 --> Helper loaded: html_helper
DEBUG - 2013-06-03 21:21:30 --> Helper loaded: markdown_helper
DEBUG - 2013-06-03 21:21:30 --> Helper loaded: language_helper
DEBUG - 2013-06-03 21:21:30 --> Helper loaded: string_helper
DEBUG - 2013-06-03 21:21:30 --> Helper loaded: date_helper
DEBUG - 2013-06-03 21:21:30 --> Helper loaded: widget_helper
DEBUG - 2013-06-03 21:21:30 --> Language file loaded: language/english/general_lang.php
DEBUG - 2013-06-03 21:21:30 --> Database Driver Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Session Class Initialized
DEBUG - 2013-06-03 21:21:30 --> A session cookie was not found.
DEBUG - 2013-06-03 21:21:30 --> Session routines successfully run
DEBUG - 2013-06-03 21:21:30 --> Config file loaded: ../application/config/ion_auth.php
DEBUG - 2013-06-03 21:21:30 --> Email Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Session class already loaded. Second attempt ignored.
DEBUG - 2013-06-03 21:21:30 --> Language file loaded: language/english/ion_auth_lang.php
DEBUG - 2013-06-03 21:21:30 --> Model Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Model Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Helper loaded: cookie_helper
DEBUG - 2013-06-03 21:21:30 --> Session class already loaded. Second attempt ignored.
DEBUG - 2013-06-03 21:21:30 --> Carabiner: Library initialized.
DEBUG - 2013-06-03 21:21:30 --> Config file loaded: ../application/config/carabiner.php
DEBUG - 2013-06-03 21:21:30 --> Carabiner: config loaded from config file.
DEBUG - 2013-06-03 21:21:30 --> Carabiner: library configured.
DEBUG - 2013-06-03 21:21:30 --> Simple ACL library initialized
DEBUG - 2013-06-03 21:21:30 --> Controller Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Model Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Model Class Initialized
DEBUG - 2013-06-03 21:21:30 --> Model Class Initialized