将 php4/mysql4 迁移到 php5/mysql5:预期的 php 问题?
我有一个遗留的Web应用程序php4/mysql4(MyISAM,数据库包含一些cms,一些用户数据,一些日历应用程序)。 现在我要迁移到带有 php5/mysql5 的新服务器。
在这种迁移场景中,典型的 php 问题是什么(php、sql 查询等)?
我听说函数参数传递发生了变化,按引用调用/按值调用。 你能举个例子或者解释一下吗?
还有什么我应该注意的吗?
(mysql问题在另一个问题中介绍:Migrating php4/ mysql4 到 php5/mysql5:切换到 InnoDB?)
I have a legacy web application php4/mysql4 (MyISAM, db contains some cms, some user data, some calendar application). Now I am going to migrate to a new server with php5/mysql5.
What are the typical php issues in such a migration scenary (php, sql queries, anything)?
I've heard that the function parameter passing changed, call-by-reference / call-by-value. Can you give an example or explain?
Anything else I should be aware of?
(The mysql issues are covered in a different question: Migrating php4/mysql4 to php5/mysql5: switch to InnoDB?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
大多数 PHP 4/5 兼容性问题有两件事:
大多数 v4 代码在 v5 中运行得很好。 您可能遇到问题的地方是依赖于 v4 类模型限制或利用 v4 参考怪癖的代码。 但大多数人不会根据这些限制进行编码(我有 - 这就是为什么我知道它们在那里)。
如果您受类/对象限制的困扰,您可以在“v1”模式下运行 Zend 引擎,这使得类和对象的行为类似于 v4。 这是有记录的。
Most of the PHP 4/5 compatibility issues are two things:
Most v4 code will run just fine in v5. Where you are likely to run up against problems is code that depends on the limitations of v4's class model or takes advantage of v4's reference quirks. But most people don't code up against those limits (I have - that's why I know they're there).
If you are stuck with the class/object limits, you can run the Zend engine in a "v1" mode which makes the classes and objects behave like in v4. This is documented.
我认为最好的迁移帮助来自 PHP 人员自己。
I think the best migration help is from the PHP guys themselves.
我正在进行迁移,发现很多别名问题。
如果您想拥有干净的代码,那么您需要找到适合您的特定代码片段的正确解决方案。 如果清洁度不是那么重要,您可能会发现此功能非常有用:
I'm in the middle of a migration and I'm finding lots of aliasing problems.
If you want to have a clean code, then you'll need to find the proper solution to your specific snippet. If cleanness is not that important, you might find this function really useful: