Codeigniter Cpanel Mysql数据库设置

时间:2016-08-19 13:51:58

标签: mysql codeigniter mysqli smarty cpanel

我已成功将codeigniter项目推送到cpanel控制台。 除数据库连接外,一切似乎都运行良好。 我相信我的设置正确但我可能是错的。 以下是我的 database.php 脚本:

$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
 );

我有以下错误:

  

遇到PHP错误

     

严重性:警告

     

消息:mysqli :: real_connect():( HY000 / 1044):拒绝用户访问   'instadri_insta'@'localhost'到数据库'instadri_ver'

     

文件名:mysqli / mysqli_driver.php

     

行号:202

     

回溯:

     

文件:/home/instadri/application/controllers/Welcome.php行:10   功能:__construct

     

文件:/home/instadri/public_html/index.php行:319功能:   require_once

我也得到:

  

遇到PHP错误

     

严重性:警告

     

消息:无法修改标头信息 - 已发送的标头   (输出从/home/instadri/system/core/Exceptions.php:272开始)

     

文件名:core / Common.php

     

行号:568

     

回溯:

     

文件:/home/instadri/application/controllers/Welcome.php行:10   功能:__construct

     

文件:/home/instadri/public_html/index.php行:319功能:   require_once

最后:

  

无法使用提供的设置连接到数据库服务器。

     

文件名:controllers / Welcome.php

     

行号:10

我已经照顾到了上述情况。 现在的新问题是加载智能模板文件。 我有一个控制器可以做到这一点:

  $this->smarty->view('front-theme/index.tpl', $data );

但是我收到了这个错误:

  

无法加载请求的文件:   前主题/ index.tpl里

我的cpanel目录结构是:

  
      
  • 的public_html
           - index.php
  •   
  • 申请
  •   
  • 系统公共
       -_template
       -_cache
        - 前主题
  •   

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,但我已经解决了。

只需将CI文件上传到公共html文件夹,CI文件夹中的每个内容都应该一起上传。因此,当您打开公用文件夹时,它应该填充CI文件。

保持数据库设置的方式相同,但要交叉检查您输入的有效值。最后转到config.php文件并检查基本URL变量并更改为您的URL链接名称。

就是这样!