Reputation: 186752
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
.
Upvotes: 2
Views: 2196
Reputation: 124365
This one works fine: https://github.com/beberlei/Zend_Db-Adapter-for-ext-mysql
I agree with the other answers that you should enable mysqli or pdo_mysql if you can. Since we don't live in a perfect bloody world where developers always have control of their deployment environments, though, I thought I'd actually give you what you asked for too.
Upvotes: 0
Reputation: 562911
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.
Upvotes: 3
Reputation: 10095
No, there is no native adapters. But you can try to write your own, it's simple. You even don't need to create all methods which the other adapters have (but you must implement all abstract methods - at least leave them empty, or you will be getting a Fatal Error). You can use a Mysqli adapter (for example) as a base for yours (I think, not a base class, but an example of code).
class My_Db_Adapter_MySQL extends Zend_Db_Adapter_Abstract {
// your code
}
and then just use My_Db_Adapter_MySQL as a name for your adapter
Upvotes: 1