mysqlzend-db

Zend_DB - Use native MySQL adapter instead of MySQLi or PDO?


The server I'm porting to doesn't have PDO nor Mysqli extensions enabled ( though it is running PHP5 ). I don't see any MySql.php class in Zend/Db/Adapter - is there some convention to using native MySQL? Or some sort of workaround? Perhaps using an older version of Zend?

And I don't have access to modify the php.ini.


Solution

  • I worked on the Zend_Db adapters quite a bit while I worked on the ZF project.

    We couldn't support a Zend_Db adapter for the plain MySQL extension, because so much of Zend_Db relies on prepared statements, as well as other features that are only found in the MySQLi and PDO_MySQL extensions.

    There is no advantage to using the MySQL extension. There's nothing "native" about it. It's just an API binding for the MySQL client library.

    I'd recommend that you enable one of MySQLi or PDO_MySQL, but you say you have no access to do that. Then your choices are:

    I recommend the first choice.


    User @farzad claims he has implemented a Zend_Db adapter for ext/mysql, but had to sacrifice some of the functionality of Zend_Db.