2
I am running a test with the codeigniter 3.1.5 framework and when trying to connect with the database it presents the following error:
Fatal error: Call to Undefined Function mysqli_init()
The description of the complete error:
Fatal error: Call to Undefined Function mysqli_init()
in C: vm ci system database drivers mysqli mysqli_driver.php on line 135
A PHP Error was encountered Severity: Error
Message: Call to Undefined Function mysqli_init()
Filename: mysqli/mysqli_driver.php
Line Number: 135
Backtrace:
I really want to know where I’m going wrong! My scenario is very simple:
- Windows 10 Enterprise
- PHP 5.6.1 installed
- Using the built-in PHP server
php -S localhost:8080
- Mysql installed in 3309 port version 5.7.18
The databese CI configuration code:
active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => 'root',
'database' => 'blog',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => TRUE,
'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,
'port'=>'3309'
);
I want to know what’s wrong there?
Mysqli is active in php.ini ?
– Otto
@Otto Yes this one! It displays the following message in CLI: PHP Startup: Unable to load Dynamic library 'C: php ext php_mysqli.dll' - Could not find the specified module. in <b>Unknown</b> on line <b>0</b><br /> DLL is in the ext folder along with php on my machine like this: C: php5 ext
– jmfrolim
So just by the message we identify that it is trying to search in the wrong path would be interesting to analyze it. But we have already identified that it is not a problem in CI but configuration of php
– Otto
Otto, I managed to solve here was actually quite simple, it was only point in INI php the path of PHP extensions
– jmfrolim
If someone has this problem in the future with CI or another tool is the tip to look at the INI of PHP line: extension_dir= 'here you put the path of ext' In my case it was extension_dir = "C://php5/ext"
– jmfrolim