Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacement for PEAR: MDB2 on PHP 5.3

Tags:

php

mysql

pear

mdb2

I've been using pear packages in php for years. I'm in the process of upgrading/moving a sites that uses the MDB2 pear package and it has not been updated for PHP 5.3.X.

In 5.3, MDB2 is returning those new annoying errors.

Unknown: Assigning the return value of new by reference is deprecated in /usr/local/lib/php/MDB2.php on line 390

I know I can change my error reporting settings to get rid of them, but I'd rather not make any exceptions. Anyway, Is anyone else using MDB2 these days and have a solution? Are there similar database packages you recommend?

like image 441
mattweg Avatar asked Oct 07 '09 07:10

mattweg


3 Answers

I would definitly go for an ORM, at least if you are working on a big project, for which you don't want to use mysqli_* or PDO functions/methods directly -- Doctrine being the most developped/used, nowadays (It's the default ORM of the symfony Framework, and can be integrated in Zend Framework quite easily).

About the E_DEPRECATED errors, though : PHP 5.3 is quite young, and lots of libraries/software/projects have not been adapted yet -- you'll probably have lots of those in the next couple of months :-(

like image 115
Pascal MARTIN Avatar answered Nov 04 '22 10:11

Pascal MARTIN


You can also upgrade to the beta 3 version via the command line

pear upgrade MDB2-beta
pear upgrade MDB2_Driver_Mysql-beta

Explanation of why current stable version isn't compliant with strict error reporting: http://pear.php.net/bugs/bug.php?id=9756

Source for the command:
http://pear.php.net/bugs/bug.php?id=18050

like image 34
jakimfett Avatar answered Nov 04 '22 10:11

jakimfett


I'm going to comment on this, since it's coming up high on Google search results for the problem.

I contacted the lead developer for MDB2, who said:

please check out a copy of MDB2 from SVN, it's fully PHP5.3 compatible, with many performance improvements. I'm currently waiting for some fixes to the new SQL Server driver (Microsoft is working on it this very week), then I'll push a new stable release.

(Edit, 4 years later: This is no longer right, do not do this)

like image 7
Aquarion Avatar answered Nov 04 '22 09:11

Aquarion