PEAR的替换:PHP 5.3上的MDB2

时间:2022-04-06 07:17:50

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.

我已经在php中使用梨包多年了。我正在升级/移动使用MDB2 pear包的网站,但尚未针对PHP 5.3.X进行更新。

In 5.3, MDB2 is returning those new annoying errors.

在5.3中,MDB2正在返回那些新的恼人错误。

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?

我知道我可以更改我的错误报告设置以摆脱它们,但我宁愿不做任何例外。无论如何,这些天有没有其他人使用MDB2并有解决方案?您推荐的类似数据库包吗?

7 个解决方案

#1


9  

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).

我肯定会去一个ORM,至少如果你正在开展一个大项目,你不想直接使用mysqli_ *或PDO函数/方法 - Doctrine是现在最发达/最常用的(它是symfony框架的默认ORM,可以很容易地集成到Zend Framework中)。

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 :-(

但是关于E_DEPRECATED错误:PHP 5.3还很年轻,很多库/软件/项目尚未适应 - 在未来几个月你可能会有很多这样的:-(

#2


9  

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

您还可以通过命令行升级到beta 3版本

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

解释当前稳定版本不符合严格错误报告的原因:http://pear.php.net/bugs/bug.php?id = 9756

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

该命令的来源:http://pear.php.net/bugs/bug.php?id = 18050

#3


7  

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

我将对此发表评论,因为它在Google搜索结果中出现问题。

I contacted the lead developer for MDB2, who said:

我联系了MDB2的首席开发人员,他说:

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.

请从SVN查看MDB2的副本,它完全兼容PHP5.3,并有许多性能改进。我正在等待对新的SQL Server驱动程序进行一些修复(微软本周正在研究它),然后我将推出一个新的稳定版本。

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

(编辑,4年后:这不再正确,不要这样做)

#4


3  

I just went and downloaded the latest version of MDB2 (MDB2-2.5.0b3) from here http://pear.php.net/package/MDB2/download and it has got rid of all my errors. Seems to work fine with PHP Version 5.3.5

我刚从http://pear.php.net/package/MDB2/download下载了最新版本的MDB2(MDB2-2.5.0b3),它已经摆脱了我的所有错误。似乎与PHP版本5.3.5一起正常工作

#5


1  

You can use Zend Framework database support or use an ORM like Doctrine or Propel

您可以使用Zend Framework数据库支持或使用Doctrine或Propel之类的ORM

#6


0  

I got around all the deprecated errors and warnings, using MDB2 and PHP 5.3, but I've gotten some really weird errors on MDB2, so wondering what's up under the hood. My environment is CentOS, PHP 5.3, MDB2-2.4.1, MySQL 5.0.77

我使用MDB2和PHP 5.3解决了所有弃用的错误和警告,但是我在MDB2上遇到了一些非常奇怪的错误,所以想知道怎么了引擎盖下的问题。我的环境是CentOS,PHP 5.3,MDB2-2.4.1,MySQL 5.0.77

Anytime, I use autoExecute 2x in a php file, the 2nd is failing (same goes if I try to use prepare and then execute). I've been logging to my MySQL query log, and while a successful INSERT will show the values, a failed INSERT will always have only the placeholders. ie: values(?, ?, ?, ?). And the MDB2_Error will always mention RECURSION

任何时候,我在php文件中使用autoExecute 2x,第二个失败(如果我尝试使用prepare然后执行则同样如此)。我一直在登录我的MySQL查询日志,虽然成功的INSERT将显示值,但失败的INSERT将始终只有占位符。即:值(?,?,?,?)。并且MDB2_Error将始终提及RECURSION

lastInsertID() never worked with MySQL tables and autoincrement fields (with mysqli driver) I did enough debugging on it, going deep into the call stack, and the result get's so wrapped up in Objects, that you can't tell what it is, until the very end. I'd love to be using MDB2 more, but in fact, I've had to revert back to straight mysql, numerous times because of these issues. Maybe Lucas or other developers might shed some light on this subject, or point us in the right direction.

lastInsertID()从未使用MySQL表和自动增量字段(使用mysqli驱动程序)我对它进行了足够的调试,深入调用堆栈,结果得到了如此包裹在对象中,你无法分辨它是什么,直到最后。我更喜欢使用MDB2,但事实上,由于这些问题,我不得不多次恢复直接的mysql。也许卢卡斯或其他开发者可能会对这个问题有所了解,或者指出我们正确的方向。

#7


0  

If you only use MDB2 for MySQL, you can replace it and keep majority of the functions with MDBDid: http://azure-dev.kiao.net/648-mdb2 You will only have little code to adapt.

如果你只使用MDB2 for MySQL,你可以用MDBDid替换它并保留大部分功能:http://azure-dev.kiao.net/648-mdb2你只需要很少的代码来适应。

#1


9  

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).

我肯定会去一个ORM,至少如果你正在开展一个大项目,你不想直接使用mysqli_ *或PDO函数/方法 - Doctrine是现在最发达/最常用的(它是symfony框架的默认ORM,可以很容易地集成到Zend Framework中)。

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 :-(

但是关于E_DEPRECATED错误:PHP 5.3还很年轻,很多库/软件/项目尚未适应 - 在未来几个月你可能会有很多这样的:-(

#2


9  

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

您还可以通过命令行升级到beta 3版本

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

解释当前稳定版本不符合严格错误报告的原因:http://pear.php.net/bugs/bug.php?id = 9756

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

该命令的来源:http://pear.php.net/bugs/bug.php?id = 18050

#3


7  

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

我将对此发表评论,因为它在Google搜索结果中出现问题。

I contacted the lead developer for MDB2, who said:

我联系了MDB2的首席开发人员,他说:

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.

请从SVN查看MDB2的副本,它完全兼容PHP5.3,并有许多性能改进。我正在等待对新的SQL Server驱动程序进行一些修复(微软本周正在研究它),然后我将推出一个新的稳定版本。

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

(编辑,4年后:这不再正确,不要这样做)

#4


3  

I just went and downloaded the latest version of MDB2 (MDB2-2.5.0b3) from here http://pear.php.net/package/MDB2/download and it has got rid of all my errors. Seems to work fine with PHP Version 5.3.5

我刚从http://pear.php.net/package/MDB2/download下载了最新版本的MDB2(MDB2-2.5.0b3),它已经摆脱了我的所有错误。似乎与PHP版本5.3.5一起正常工作

#5


1  

You can use Zend Framework database support or use an ORM like Doctrine or Propel

您可以使用Zend Framework数据库支持或使用Doctrine或Propel之类的ORM

#6


0  

I got around all the deprecated errors and warnings, using MDB2 and PHP 5.3, but I've gotten some really weird errors on MDB2, so wondering what's up under the hood. My environment is CentOS, PHP 5.3, MDB2-2.4.1, MySQL 5.0.77

我使用MDB2和PHP 5.3解决了所有弃用的错误和警告,但是我在MDB2上遇到了一些非常奇怪的错误,所以想知道怎么了引擎盖下的问题。我的环境是CentOS,PHP 5.3,MDB2-2.4.1,MySQL 5.0.77

Anytime, I use autoExecute 2x in a php file, the 2nd is failing (same goes if I try to use prepare and then execute). I've been logging to my MySQL query log, and while a successful INSERT will show the values, a failed INSERT will always have only the placeholders. ie: values(?, ?, ?, ?). And the MDB2_Error will always mention RECURSION

任何时候,我在php文件中使用autoExecute 2x,第二个失败(如果我尝试使用prepare然后执行则同样如此)。我一直在登录我的MySQL查询日志,虽然成功的INSERT将显示值,但失败的INSERT将始终只有占位符。即:值(?,?,?,?)。并且MDB2_Error将始终提及RECURSION

lastInsertID() never worked with MySQL tables and autoincrement fields (with mysqli driver) I did enough debugging on it, going deep into the call stack, and the result get's so wrapped up in Objects, that you can't tell what it is, until the very end. I'd love to be using MDB2 more, but in fact, I've had to revert back to straight mysql, numerous times because of these issues. Maybe Lucas or other developers might shed some light on this subject, or point us in the right direction.

lastInsertID()从未使用MySQL表和自动增量字段(使用mysqli驱动程序)我对它进行了足够的调试,深入调用堆栈,结果得到了如此包裹在对象中,你无法分辨它是什么,直到最后。我更喜欢使用MDB2,但事实上,由于这些问题,我不得不多次恢复直接的mysql。也许卢卡斯或其他开发者可能会对这个问题有所了解,或者指出我们正确的方向。

#7


0  

If you only use MDB2 for MySQL, you can replace it and keep majority of the functions with MDBDid: http://azure-dev.kiao.net/648-mdb2 You will only have little code to adapt.

如果你只使用MDB2 for MySQL,你可以用MDBDid替换它并保留大部分功能:http://azure-dev.kiao.net/648-mdb2你只需要很少的代码来适应。