I'm building a webapp for a department on a large college campus that will eventually be run on the enterprise servers ( I use the term 'enterprise' loosely ).
The problem is that the admins have refused to compile and enable any PDO extension other than SQLite. They do have mysql and mysqli enabled though, so it's not a total loss.
So does anybody out here know of a good ORM for PHP that does NOT rely on PDO as it's main engine?
I've already looked at Doctrine and Propel (both excellent frameworks), tho开发者_StackOverflow社区ugh could not figure out how to rip PDO out from inside them.
Edit: Here is the response I've gotten from the admins on the server:
Sean,
We have tried, unsuccessfully, several times to build PHP with the PDO extension included. The reason we haven't been successful is complicated, but basically stems from the fact that the web envoronment was originally set up with some database driver libraries compiled staticly and others compiled dynamically, the mix causing PDO to complain loudly. The reason things were were done this way was due to a bug in early versions of PHP 5.x that is no longer an issue today (or at least less of one), but switching is difficult because the change would require modifications to php.ini files and, since every site (including sites on [server redacted]) has its own php.ini (roughly 22,000 files total, many of which are modified by users) it is very difficult to push out that change (and not making the change causes errors [I don't recall if they are fatal or not] on pages served from accounts with non-updated files).
I suppose that every modern ORM relies on PDO as it's a standard database driver.
If you have MySQLi extension enabled then you should be able to write your own PDO (IIRC MySQLi supports everything that PDO does).
if (extension_loaded('pdo_mysql') == false) {
class PDO {
protected $connection;
public function __construct($dsn, $username = null, $password = null, array $driver_options = array()) {
$this->connection = new MySQLi(...);
}
}
class PDOStatement { ... }
class PDOException extends RuntimeException { ... }
}
You'll have to implement whole PDO API but at least it will works.
精彩评论