How to keep PHP 5.5 but use 5.4 (CodeIgniter depre

2019-05-18 18:50发布

问题:

I have a dedicated server running with ISPConfig 3. It came under Debian 7 (officially PHP 5.4). I have upgraded it to PHP 5.5.

However, I didn't realize that CodeIgniter needs the mysql driver to run... Therefore, my website doesn't work anymore.

So either I find a way to use PHP 5.4 only on a website (without affecting the others running under PHP 5.5) or I find a way to "upgrade" CodeIgniter so it doesn't use the deprecated mysql extension anymore.

回答1:

I believe you can make this simple change to config/database.php

Change

$db['default']['dbdriver'] = "mysql";

to:

$db['default']['dbdriver'] = "mysqli";

As CI uses a database abstraction layer, this should be transarent.