codeigniter: Message: Module 'mysqli' alre

2019-02-25 16:12发布

问题:

I'm setting up a new project in codeigniter and after uploading all files to the live server, I got this error upon loading the website:

A PHP Error was encountered

Severity: Core Warning

Message: Module 'mysqli' already loaded

Filename: Unknown

Line Number: 0

Backtrace:

It's given line number 0 and I don't where I made the mistake. I'm not getting this error in localhost. Can anyone tell me how to fix this?

回答1:

You're trying to load the php module the second time. It's probably already set to load in php.ini file, and you try to load again dynamically somewhere inside your project. You could either comment that line inside php.ini and restart Apache, or find and delete the line that could be something like

dl('php_mysqli.dll'); // on Windows 

or

dl('mysqli.so'); // on Linux

,somewhere inside a .php file.

Better yet, test before attempting to load:

if (!extension_loaded('mysqli')) {
    dl('php_mysqli.dll');
}