我在尝试运行CodeIgniter项目时遇到以下问题,但是在通过xampp为该项目提供服务的浏览器中通过url访问该项目时遇到以下错误:
Fatal error: Uncaught Error: Call to undefined function mysql_pconnect() in
C:\xampp\htdocs\TaxiCMS\system\database\drivers\mysql\mysql_driver.php:91 Stack trace:
#0 C:\xampp\htdocs\TaxiCMS\system\database\DB_driver.php(115): CI_DB_mysql_driver->db_pconnect()
#1 C:\xampp\htdocs\TaxiCMS\system\database\DB.php(148): CI_DB_driver->initialize()
#2 C:\xampp\htdocs\TaxiCMS\system\core\Loader.php(346): DB(Array, NULL)
#3 C:\xampp\htdocs\TaxiCMS\system\core\Loader.php(1171): CI_Loader->database()
#4 C:\xampp\htdocs\TaxiCMS\system\core\Loader.php(152): CI_Loader->_ci_autoloader()
#5 C:\xampp\htdocs\TaxiCMS\system\core\Controller.php(51): CI_Loader->initialize()
#6 C:\xampp\htdocs\TaxiCMS\application\controllers\admin.php(10): CI_Controller->__construct()
#7 C:\xampp\htdocs\TaxiCMS\system\core\CodeIgniter.php(308): Admin->__construct()
#8 C:\xampp\htdocs\TaxiCMS\index.php(202): require_once('C:\\xampp\\htdocs...')
#9 {main} thrown in C:\xampp\htdocs\TaxiCMS\system\database\drivers\mysql\mysql_driver.php on line 91
答案 0 :(得分:1)
数据库配置文件夹如下
<?php
.....
$db["default"]["hostname"] = "localhost";
$db["default"]["username"] = "root";
$db["default"]["password"] = "";
//$db["default"]["database"] ="test";
$db["default"]["database"] ="test;
$db["default"]["dbdriver"] = 'mysql';
$db["default"]["dbprefix"] = "";
$db["default"]["pconnect"] = TRUE;
$db["default"]["db_debug"] = FALSE;
$db["default"]["cache_on"] = FALSE;
$db["default"]["cachedir"] = "";
....
解决方案只是改变
$db['default']['dbdriver'] = 'mysql';
至
$db['default']['dbdriver'] = 'mysqli';