1

Actually I'm trying to configure my codeigniter live file to localhost.

I have,

  1. created a database called test_bs
  2. then imported the tables
  3. Then change the base_url like $config['base_url']=http://localhost/gu_ci/'; and $config['index_page']='index.php'; in config.php
  4. And then did a change on database.php,Which contains

    $active_group = 'default';
    $active_record = TRUE;
    
    $db['default']['hostname'] = 'localhost';
    $db['default']['username'] = 'root';
    $db['default']['password'] = ' ';
    $db['default']['database'] = 'test_bs';
    $db['default']['dbdriver'] = 'mysql';
    $db['default']['dbprefix'] = '';
    $db['default']['pconnect'] = TRUE;
    $db['default']['db_debug'] = TRUE;
    $db['default']['cache_on'] = TRUE;
    $db['default']['cachedir'] = 'application/cache/';
    $db['default']['char_set'] = 'utf8';
    $db['default']['dbcollat'] = 'utf8_general_ci';
    $db['default']['swap_pre'] = '';
    $db['default']['autoinit'] = TRUE;
    $db['default']['stricton'] = FALSE;
    

My .htacess file having:

  RewriteEngine On
  RewriteBase /new_admin/

  RewriteCond %{REQUEST_URI} PIE.htc
  AddType text/x-component .htc
  RewriteRule (.*) static/PIE.htc [L]

  RewriteCond %{REQUEST_URI} !^/new_admin/static/

  RewriteRule (.*)$ index.php [L]

I'm getting the following error:

     A Database Error Occurred

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

     Filename: C:\xampp\htdocs\gunify_ci\system\database\DB_driver.php

     Line Number: 124

I have referred Refer1, Refer2,Refer3,Refer4,Refer5 and so on... The last link just display the welcome message like: enter image description here But none of the solution helped me!!

Guide me to solve this!!

17
  • What do you use, WAMP Server? Commented Jun 23, 2015 at 8:51
  • Is there a space $db['default']['password'] = ' '; ? Commented Jun 23, 2015 at 8:51
  • yes ji....it has,but if i removed that space also no change Commented Jun 23, 2015 at 8:52
  • your database credentials seem to be wrong. Check the password that you have given is correct or not. Commented Jun 23, 2015 at 8:52
  • @HarigovindR actually where we can check our password? Because i have use a password field as empty for all other projects in php Commented Jun 23, 2015 at 8:54

1 Answer 1

4

$db['default']['password'] = ''; there is an space, remove it

use below settings

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'test_bs';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$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;

Edit 01

Use this .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule>

Edit 02

your folder structurer should be

  1. Application
  2. assets
    • css
      1. boostrap.css
      2. style.css
    • js
    • images
  3. system
  4. .htacess
  5. index.php

so code will be:

<link href="<?php echo base_url(); ?>assets/css/bootstrap.css" rel="stylesheet" />
Sign up to request clarification or add additional context in comments.

1 Comment

Comments are not for extended discussion; this conversation has been moved to chat.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.