Can any one help me, how to use mysqli instead of mysql in Yii framework.
What are the steps we need to check, if we want to convert from mysql to mysqli. I have looked into config/main.php and there its showing mysql connection code like this:-
// uncomment the following to use a MySQL database
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=mydbname',
'emulatePrepare' => true,
'username' => 'username',
'password' => 'password',
'charset' => 'utf8',
),
]
Neither mysql nor mysqli extension is supported by Yii. It uses PDO instead. No need to worry about it, PDO works perfectly well with MySQL databases, just make sure it’s installed on your system.
I saw this article too but fear not as S Dev said before - yii uses PDO to interact with the database.
In general, PDO is the preferred method, since it provides a unified data access to multiple db engine layers not just for MySQL, but can work with Postgres, Microsoft, Oracle etc.
I actually worry because of one simple but important thing.
What about performance? If you’re going to build an all-mysql site, and so you don’t need PDO abstraction, isn’t PDO slower than mysqli?
Simple benchmarks seem to show that PDO is slower. I ran one myself, that i found around the web, and it shows that PDO is at least 2 times slower than mysqli.