Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter error: Call to undefined function mysql_pconnect()

I have updated my codeigniter version from 2.2.4 step by step to 3.0.6 and I get an error:

An uncaught Exception was encountered  Type: Error  Message: Call to undefined function mysql_pconnect()  Filename: path-to-project\system\database\drivers\mysql\mysql_driver.php  Line Number: 135  Backtrace:  File: path-to-project\application\controllers\Main.php Line: 10 Function: __construct  File: path-to-project\index.php Line: 315 Function: require_once 

I have just replaced my index.php file and system directory with the new one and made some changes in my application according to tutorial.

and this is the Main controller:

class Main extends CI_Controller {      function __construct()     {         parent::__construct();         $this->load->model('main_model');     } } 

What causes the problem?!

And this is the link of the tutorial.

like image 430
Afshin Avatar asked Apr 24 '16 11:04

Afshin


People also ask

What is uncaught error call to undefined function mysql_connect ()?

Fatal Error: 'Call to undefined function mysql_connect()' If you get an error like Fatal error: Call to undefined function mysql_connect() when trying to install GFI HelpDesk, it probably means that MySQL support has not been enabled for PHP on your server (that is, the PHP module php-mysql has not been installed).

What is Mysql_pconnect?

The mysql_pconnect() function opens a persistent MySQL connection. This function returns the connection on success, or FALSE and an error on failure. You can hide the error output by adding an '@' in front of the function name.


1 Answers

Deprecated features in PHP 5.5.x:

The original MySQL extension is now deprecated, and will generate E_DEPRECATED errors when connecting to a database. Instead, use the MySQLi or PDO_MySQL extensions.

You're using the deprecated 'mysql' dbdriver. Locate the config/database.php file and change dbdriver to use 'mysqli' :

$db['default']['dbdriver'] = 'mysqli';  
like image 118
Shaya Avatar answered Oct 05 '22 15:10

Shaya