CodeIgniter Forums

Full Version: DB Connection Issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]latuss[/eluser]
Hi all... I got a DB connection problem..
this is my DB config

Code:
$active_group = "default";

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "root";
$db['default']['database'] = "test";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['active_r'] = TRUE;
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";

the autoload.php

Code:
$autoload['libraries'] = array('database');

And the Problem?? Blank Screen...
I install phpmyadmin.. and is working with the same params in the config...

any ideas??


ubuntu feisty, php5, mysql5


thks

El Forum

[eluser]coolfactor[/eluser]
Can you connect using standard php mysql_connect() function?

El Forum

[eluser]latuss[/eluser]
mmm.. I put this in the controller
Code:
function index()
    {
        $this->load->view('welcome_message');
        $link = mysql_connect('localhost:3306', 'root', 'root');
        if (!$link) {
            die('Could not connect: ' . mysql_error());
        }
        echo 'Connected successfully';
        mysql_close($link);
    }

and I get this error

Code:
Fatal error: Call to undefined function mysql_connect() in /var/www/code/system/application/controllers/welcome.php on line 14

El Forum

[eluser]latuss[/eluser]
ups... in phpinfo() there is no mysql.... but I got installed the php-mysql module

El Forum

[eluser]latuss[/eluser]
na.. now works... but with the mysql_connect manually....

El Forum

[eluser]latuss[/eluser]
Ok, solved... I edit the php.ini and add this line

extension=mysql.so

Thanks

El Forum

[eluser]coolfactor[/eluser]
Thanks for following up with your solution. Glad you got it fixed.