2016-08-19 89 views
0

我已經成功地將一個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
+2

仔細檢查是否創建了db用戶。如果該用戶與該數據庫關聯。如果密碼正確保存。順便說一句。絕不要在這樣的公共場所暴露證件。 – Tpojka

+0

您的主機數據庫可能不再是您的主機上的'localhost'。檢查以確保您擁有合適的主機。 – coderodour

+0

嗨,我已經解決了這個問題。謝謝。 我現在只剩下一個問題。 我的聰明沒有加載。 –

回答

1

我有同樣的問題,但我有解決了它。

只需將您的CI文件上傳到公共html文件夾,CI文件夾中的每一件東西都應該一起上傳。所以當你打開公用文件夾時,它應該填充CI文件。

以相同的方式留下您的數據庫設置,但交叉檢查您輸入的有效性值。最後轉到config.php文件並檢查基本url變量並更改爲您的url鏈接名稱。

就是這樣!

+0

我有同樣的問題,但我已經解決了它,請聯繫我以獲取更多信息 –

+0

我已經完成了它,但是不要將附件添加到**自己的帖子**中,您應該修改它們。 –

+0

新來這個,謝謝喬 –