Welcome Guest, Not a member yet? Register   Sign In
Codeigniter deprecate Message After Moving From 2.1 to 3.0
#1

I recently got this script of the web for ajax dropdown populate fields (v 2.1)

I works fine if run with same version but if I try to upgrade to 3.0, I get this error:


Quote:A PHP Error was encountered
Severity: 8192
Message: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead
Filename: mysql/mysql_driver.php
Line Number: 135

But the script still works.

I don't understand this error as I can't find mysql_driver.php or mysql_pconnect either. Please help.
Reply
#2

It is the error by PHP, not CodeIgniter.
The mysql extension that provide all `mysql_*()` functions was deprecated on PHP 5.5, and was removed on PHP 7.
Reply
#3

There might be possibility that you php will be upgraded.  Php Mysql is deprecated form latest since 5.5. For refence see http://php.net/manual/en/migration55.deprecated.php. You should move to mysql database driver to mysqli because from php 7 mysql php will be removed from php. Mysqli driver  is very similar to mysql driver.

To move mysql to mysql just go to Application/Config/database.php file and change dbdriver element value to mysqli in $db['default'] array. It's looks like following

$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'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
);

You can use pdo database driver also instead of mysqli. But I prefer mysqli driver to connect with mysql database due to mysqli has slight more speed performance in compare to pdo for mysql database.
[email protected]
Php Team Leader, freelancer
github.com/pmbaldha
Reply
#4

(12-26-2015, 11:53 PM)pmbaldha Wrote: There might be possibility that you php will be upgraded.  Php Mysql is deprecated form latest since 5.5. For refence see http://php.net/manual/en/migration55.deprecated.php. You should move to mysql database driver to mysqli because from php 7 mysql php will be removed from php. Mysqli driver  is very similar to mysql driver.

To move mysql to mysql just go to Application/Config/database.php file and change dbdriver element value to mysqli in $db['default'] array. It's looks like following

$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'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
);

You can use pdo database driver also instead of mysqli. But I prefer mysqli driver to connect with mysql database due to mysqli has slight more speed performance in compare to pdo for mysql database.

Thanks @pmbaldha, but when I change it to mysqli, I stop getting out put on view..

I have

Code:
else {
echo 'No countries  found'
}
on view
Reply
#5

(12-27-2015, 06:24 AM)Codeigniter_Learner Wrote:
(12-26-2015, 11:53 PM)pmbaldha Wrote: There might be possibility that you php will be upgraded.  Php Mysql is deprecated form latest since 5.5. For refence see http://php.net/manual/en/migration55.deprecated.php. You should move to mysql database driver to mysqli because from php 7 mysql php will be removed from php. Mysqli driver  is very similar to mysql driver.

To move mysql to mysql just go to Application/Config/database.php file and change dbdriver element value to mysqli in $db['default'] array. It's looks like following

$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'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
);

You can use pdo database driver also instead of mysqli. But I prefer mysqli driver to connect with mysql database due to mysqli has slight more speed performance in compare to pdo for mysql database.

Thanks @pmbaldha, but when I change it to mysqli, I stop getting out put on view..

I have

Code:
else {
echo 'No countries  found'
}
on view

My database is
Code:
$active_group = 'default';
$active_record = TRUE;


$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '***';
$db['default']['database'] = '***';

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




Theme © iAndrew 2016 - Forum software by © MyBB