Fadil Olamyy Wahab
Fadil Olamyy Wahab

Reputation: 626

Codeigniter Cpanel Mysql Database Setup

I have successfully pushed a codeigniter project to a cpanel console. Everything seems to be working fine except the database connection. I believe i have the settings correct but i could be wrong. Below is my database.php script:

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

I have the errors below:

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

I also get :

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

And Finally :

Unable to connect to your database server using the provided settings.

Filename: controllers/Welcome.php

Line Number: 10

I have taken care of the above. The new issue now is the smarty template file loading. I have a controller that does this :

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

But i get this error:

Unable to load the requested file: front-theme/index.tpl

My cpanel directory structure is:

  • public_html
    - index.php
  • application
  • system public
    -_template
    -_cache
    -front-theme

Upvotes: 1

Views: 2088

Answers (1)

Fillz Adebayo
Fillz Adebayo

Reputation: 670

I had the same problem but I have solved it.

Simply upload your CI files to the public html folder, every thing in the CI folder should be uploaded together. so when you open the public folder it should filled with the CI files.

Leave your db settings the same way, but cross-check the values you entered for validity. and finally go to the config.php file and check the base url variable and change to your url link name.

That's it!

Upvotes: 1

Related Questions