Codeigniter error: Call to undefined function mysql_pconnect()

Codeigniter error: Call to undefined function mysql_pconnect()

In this post we will show you Codeigniter error: Call to undefined function mysql_pconnect, hear for Codeigniter error: Call to undefined function mysql_pconnect we will give you demo and example for implement.

fOr remove Codeigniter error: Call to undefined function mysql_pconnect() or If you are using php 7 version the in Codeigniter will not run mysql you must need use pdo or mysqli

setp for CodeIgniter mysqli in your project

Step 1 : go to database.php and change dbdriver

/application/config/database.php

[php]
//change:
$db[‘default’][‘dbdriver’] = ‘mysql’;
//with:
$db[‘default’][‘dbdriver’] = ‘mysqli’;
[/php]

You should change the content of the file DB_driver.php in you codeigniter system directory.

Step 2 : go to DB_driver.php and change $dbdriver

Go to:
system/database/DB_driver.php
And change the following line:

[php]
var $dbdriver = ‘mysql’;
// to :
var $dbdriver = ‘mysqli’;
[/php]

here is a extraction of the DB_driver.php

[php]
* MySQLi Database Adapter Class – MySQLi only works with PHP 5
*
* Note: _DB is an extender class that the app controller
* creates dynamically based on whether the active record
* class is being used or not.
*
* @package CodeIgniter
* @subpackage Drivers
* @category Database
* @author ExpressionEngine Dev Team
* @link
*/
class CI_DB_mysqli_driver extends CI_DB {

var $dbdriver = ‘mysqli’;
[/php]

Hope this code and post will helped you for implement Codeigniter error: Call to undefined function mysql_pconnect. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve itsolutionstuck.

See also :  Two Dependent Dropdown In PHP - How to make dependent dropdown list using jquery Ajax?

Conclusion:

In conclusion, encountering the error “Call to undefined function mysql_pconnect()” in CodeIgniter indicates a compatibility issue with PHP 7 or later versions, as the mysql functions are deprecated. To resolve this error, it’s essential to switch to either PDO or MySQLi.

We hope this solution effectively addresses the issue and helps you continue working smoothly with your CodeIgniter project. If you require further assistance or have any feedback, please feel free to leave a comment. Your input is invaluable as we strive to enhance our content and provide better solutions to our readers. Thank you for choosing itSolutionStuck!

Leave a Comment