Codeigniter database connection

Discussion in 'Programming/Scripts' started by Tom John, Nov 16, 2019.

  1. Tom John

    Tom John Member HowtoForge Supporter

    Hi Guys,
    someone built me a script in php with codeigniter and i moved the script to another website.
    I dont know where to change the database connection data in the script maybe someone can help me?

    i thought the data of the database connection i can find in:
    $db['default'] = array(
        'dsn' => '',
        'hostname' => getenv('DB_HOSTNAME'),
        'port' => getenv('DB_PORT'),
        'username' => getenv('DB_USERNAME'),
        'password' => getenv('DB_PASSWORD'),
        'database' => getenv('DB_DATABASE'),
        'dbdriver' => 'mysqli',
        'dbprefix' => '',
        'pconnect' => FALSE,
        'db_debug' => (ENVIRONMENT !== 'production'),
        'cache_on' => FALSE,
        'cachedir' => '',
        'char_set' => 'utf8',
        'dbcollat' => 'utf8_general_ci',
        'swap_pre' => '',
        'encrypt' => FALSE,
        'compress' => FALSE,
        'stricton' => FALSE,
        'failover' => array(),
        'save_queries' => TRUE
    where can i put the hostname, username pw database etc?
    thanks in advance for your kind help
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Looks like that script takes the values from environment variables. Maybe a php file is run prior to that that sets environment variables DB_HOSTNAME etc. to suitable values? Ask Somene how the script is supposed to work.
    Or search for those variable names in all the files, Use for example grep:
    grep -R DB_HOSTNAME application/*

Share This Page