This question already has answers here:
Codeigniter: fatal error call to undefined function mysqli_init()
(14 answers)
Closed 2 days ago.
An uncaught Exception was encountered
Type: Error
Message: Call to undefined function mysqli_init()
Filename: /home/sourcecars/public_html/carsonbarlcon.com/system/database/drivers/mysqli/mysqli_driver.php
Line Number: 135
Backtrace:
File: /home/sourcecars/public_html/carsonbarlcon.com/application/hooks/EloquentHook.php
Line: 31
Function: database
File: /home/sourcecars/public_html/carsonbarlcon.com/application/hooks/EloquentHook.php
Line: 46
Function: loadDatabase
File: /home/sourcecars/public_html/carsonbarlcon.com/index.php
Line: 316
Function: require_once
Install mysqli php extension
please check php-mysqli is installed?
check php.ini and make sure the extension is loaded.
extension=php_mysqli.dll
if it's a php framework make sure in the framework config.php file what driver you are using.
Related
I wanted to test running a php function via CMD, but when i run php index.php Cron test i get:
An uncaught Exception was encountered
Type: Error
Message: Call to undefined function mysqli_init()
Filename: C:\xampp2\htdocs\flybyspace\system\database\drivers\mysqli\mysqli_driver.php
Line Number: 135
Backtrace:
File: C:\xampp2\htdocs\flybyspace\application\models\Booking_Model.php
C:\xampp2\htdocs\flybyspace>php index.php Cron test
An uncaught Exception was encountered
Type: Error
Message: Call to undefined function mysqli_init()
Filename: C:\xampp2\htdocs\flybyspace\system\database\drivers\mysqli\mysqli_driver.php
Line Number: 135
Backtrace:
File: C:\xampp2\htdocs\flybyspace\application\models\Booking_Model.php
Line: 5
Function: database
File: C:\xampp2\htdocs\flybyspace\index.php
Line: 315
Function: require_once
the php function:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Cron extends CI_Controller
{
public function test($to = 'World')
{
echo "Hello {$to}!".PHP_EOL;
}
}
?>
im using codeigniter and XAMPP for my local server and DB.
other answers on stackoverflow say i should uncomment extension=mysqli in php.ini but mine is already uncommented so that is not the correct solution in my case.
the problem was that i had 2 installations of XAMPP, the older vesion didn't have a php.ini file at all. adding the file fixt the problem.
all my files were in the htdocs folder of the second installation so i'm not sure how the older version affected my new one.
For the first time I see this message error after I put https in my codeigniter website.
Message: Call to undefined function iconv()
Filename: /home/admedica/public_html/admedicall_v1/application/views/admin/billing/bill/centro/bill.php
Line Number: 45
Backtrace:
File: /home/admedica/public_html/admedicall_v1/application/controllers/Admin.php
Line: 3981
Function: view
File: /home/admedica/public_html/admedicall_v1/index.php
Line: 315
Function: require_once
Before without https it works.
How can i solve this problem ?
Although calling the same script through browser work fine, trying to trigger the same script via CLI didn't work!
The way I have to call the script I use CodeIgniter structure :
php index.php controller/function/parameter
I have also change in config file of my project:
$config['uri_protocol'] = 'AUTO'
But the problem that oci can't work within cli although it works by calling it using the browser.
THis error appear:
Fatal error: Call to undefined function oci_connect() in C:\wamp64\www\MYPROJECT\syst
em\database\drivers\oci8\oci8_driver.php on line 238
Severity: Error Message: Call to undefined function
oci_connect() Filename:
C:\wamp64\www\MYPROJECT\system\database\drivers\oci8\oci8_driver.php
Line Number: 238
I have enabled the oci extension at php.ini
extension=php_oci8_12c.dll
which is existed in the following directory:
C:\wamp64\bin\php\php5.6.19\ext\php_oci8_12c.dll
An uncaught Exception was encountered
Type: Error
Message: Call to undefined function mysql_connect()
Filename: C:\xampp\htdocs\Salab\system\database\drivers\mysql\mysql_driver.php
Line Number: 136
Backtrace:
File: C:\xampp\htdocs\Salab\application\third_party\MX\Loader.php
Line: 109 Function: DB
File: C:\xampp\htdocs\Salab\application\third_party\MX\Loader.php
Line: 65 Function: initialize
File: C:\xampp\htdocs\Salab\application\third_party\MX\Base.php Line:
55 Function: __construct
File: C:\xampp\htdocs\Salab\application\third_party\MX\Base.php Line:
60 Function: __construct
File: C:\xampp\htdocs\Salab\application\third_party\MX\Controller.php
Line: 4 Function: require
File: C:\xampp\htdocs\Salab\application\third_party\MX\Modules.php
Line: 123 Function: include_once
File:
C:\xampp\htdocs\Salab\application\modules\acesso\controllers\Acesso.php
Line: 3 Function: spl_autoload_call
File: C:\xampp\htdocs\Salab\index.php Line: 315 Function: require_once
Could you Send the method you using to connect to the database
you could try this
<?php
//Create Connection
$con=mysql_connect("localhost","root","");
//Create Database
$CreateDb="Create database db2";
mysql_query($CreateDb,$con);
//Select Database
mysql_Select_db("db2",$con);
?>
If you are using php7 you should move to mysqli as mysql was deprecated
If you are using an earlier version then it seems that the mysql extension is not installed or enabled (note that looking forward you'd better move to mysqli anyway)
Check in your php.ini file if you have the line and it's not commented:
extension=php_mysql.dll
This question already has answers here:
Why shouldn't I use mysql_* functions in PHP?
(14 answers)
Closed 7 years ago.
Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\phoenixproject\register.php:9 Stack trace: #0 {main} thrown in C:\xampp\htdocs\phoenixproject\register.php on line 9
How to solve this??
It is most likely MySql extensions are not being loaded. Open your php.ini file and check if extension=php_mysql.dll and extension=php_mysqli.dll is uncommented