我已经成功地将一个codeigniter项目推送到一个cpanel控制台。 除了数据库连接,一切似乎都正常工作。 我相信我的设置正确,但我可能是错的。 下面是我database.php中脚本:Codeigniter Cpanel Mysql数据库设置
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'instadri_insta',
'password' => 'BL9w;K;ds9MR',
'database' => 'instadri_ver',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
我有以下错误:
A PHP Error was encountered
Severity: Warning
Message: mysqli::real_connect(): (HY000/1044): Access denied for user 'instadri_insta'@'localhost' to database 'instadri_ver'
Filename: mysqli/mysqli_driver.php
Line Number: 202
Backtrace:
File: /home/instadri/application/controllers/Welcome.php Line: 10 Function: __construct
File: /home/instadri/public_html/index.php Line: 319 Function: require_once
我也得到:
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/instadri/system/core/Exceptions.php:272)
Filename: core/Common.php
Line Number: 568
Backtrace:
File: /home/instadri/application/controllers/Welcome.php Line: 10 Function: __construct
File: /home/instadri/public_html/index.php Line: 319 Function: require_once
最后:
Unable to connect to your database server using the provided settings.
Filename: controllers/Welcome.php
Line Number: 10
我已经照顾了上述情况。 现在的新问题是加载smarty模板文件。 我有一个控制器,这是否:
$this->smarty->view('front-theme/index.tpl', $data);
,但我得到这个错误:
Unable to load the requested file: front-theme/index.tpl
我的cPanel目录结构:
- public_html
- index.php- application
- system public
-_template
-_cache
-front-theme
仔细检查是否创建了db用户。如果该用户与该数据库关联。如果密码正确保存。顺便说一句。绝不要在这样的公共场所暴露证件。 – Tpojka
您的主机数据库可能不再是您的主机上的'localhost'。检查以确保您拥有合适的主机。 – coderodour
嗨,我已经解决了这个问题。谢谢。 我现在只剩下一个问题。 我的聪明没有加载。 –