0

I am trying to install my page but this error is:

Fatal error: Uncaught Error: Call to undefined function mysql_pconnect() in /homepages/14/db1/htdocs/bonoboapp/system/database/drivers/mysql/mysql_driver.php:91 
Stack trace: #0 /homepages/14/db1/htdocs/bonoboapp/system/database/DB_driver.php(115): CI_DB_mysql_driver->db_pconnect() 
#1 /homepages/14/db1/htdocs/bonoboapp/system/database/DB.php(148): CI_DB_driver->initialize() 
#2 /homepages/14/db1/htdocs/bonoboapp/carpooling/core/MY_Router.php(111): DB() 
#3 /homepages/14/db1/htdocs/bonoboapp/carpooling/core/MY_Router.php(68): My_Router->_get_db_route('login') 
#4 /homepages/14/db1/htdocs/bonoboapp/system/core/Router.php(170): My_Router->_parse_routes() 
#5 /homepages/14/db1/htdocs/bonoboapp/system/core/CodeIgniter.php(173): CI_Router->_set_routing() 
#6 /homepages/14/db1/htdocs/bonoboapp/index.php(213): require_once('/homepages/14/d...') 
#7 {main} thrown in /homepages/14/db1/htdocs/bonoboapp/system/database/drivers/mysql/mysql_driver.php on line 91

Could you helpme please.

CD001
  • 8,332
  • 3
  • 24
  • 28
Cristian
  • 33
  • 1
  • 5
  • 1
    You're probably trying to run obsolete code on a current version of PHP. – CD001 Nov 03 '17 at 09:27
  • 2
    according to this : http://php.net/manual/en/function.mysql-pconnect.php, "mysql_pconnect() This extension was deprecated in PHP 5.5.0". Use `mysqli` or `pdo` – Hamza Abdaoui Nov 03 '17 at 09:29

1 Answers1

5

I think you're using Codeigniter, this error is most likely using their Database Class and drivers so you're not using PHP's MySQL functions directly.

Therefore, all you need to do is change

$db['default']['dbdriver'] = 'mysql';

to

$db['default']['dbdriver'] = 'mysqli';

Add following settings for your database.php file

$db['default'] = array(
'dsn'   => '',
'hostname' => '',
'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
);
Aiyaz Khorajia
  • 598
  • 2
  • 11
  • Good catch on the `CI_` classes ;) – CD001 Nov 03 '17 at 09:35
  • Yeah, noticed that `CI_DB_driver` ;) – Aiyaz Khorajia Nov 03 '17 at 09:37
  • Ok, i'm use this code, but the problem is persistent: $db['default']['hostname'] = 'localhost'; $db['default']['username'] = 'root'; $db['default']['password'] = ''; $db['default']['database'] = 'carpooling'; $db['default']['dbdriver'] = 'mysqli'; $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'] = ''; – Cristian Nov 04 '17 at 11:14
  • Updating my answer for additional value. – Aiyaz Khorajia Nov 04 '17 at 11:42
  • Thanks the final code: $active_group = 'default'; $active_record = TRUE; $db['default'] = array( 'dsn' => '', 'hostname' => 'localhost', 'username' => 'root', 'password' => '', 'database' => 'carpooling', '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 ); It's correct? Appear the same error – Cristian Nov 04 '17 at 13:16
  • it should work, whats your mysql version? – Aiyaz Khorajia Nov 04 '17 at 13:24
  • Hello. i'm use MySQL 5.5 and the PHP 7.0. thanks. – Cristian Nov 05 '17 at 11:27