Zend db adapter mysqli or PDO_MYSQL

*爱你&永不变心* 提交于 2019-12-07 07:10:18

问题


I've seen several code samples that do this in application.ini

resources.db.adapter = mysqli

or 

resources.db.adapter = PDO_MYSQL

What is the real difference between the two? Does it impact my code? when should I choose one or the other?


回答1:


I developed a lot of the Zend_Db component for Zend Framework through the 1.0 release. It was the goal that the adapters function identically, or as close to it as could be supported by the PHP extension.

The same set of unit tests can be run against both MySQL adapters, with virtually no difference. Performance-wise, there's no measurable difference.

The reason you would choose one over the other, and the only reason why we supported Mysqli at all, instead of only PDO_MySQL, is that you need to deploy to a PHP environment where you don't have the PDO extension enabled, and you don't have the privilege to modify the environment. For instance, a commodity hosting environment.




回答2:


When you are deploying your application on a web server (shared hosting) using CPANEL,

  1. Check that PDO is enabled using phpinfo();. If enabled then you can use resources.db.adapter = PDO_MYSQL
  2. If PDO is not enabled the you have to go with the alternative, resources.db.adapter = mysqli.


来源:https://stackoverflow.com/questions/3844077/zend-db-adapter-mysqli-or-pdo-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!