将 php4/mysql4 迁移到 php5/mysql5:预期的 php 问题?

发布于 2024-07-17 04:51:43 字数 412 浏览 6 评论 0原文

我有一个遗留的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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

烟─花易冷 2024-07-24 04:51:43

大多数 PHP 4/5 兼容性问题有两件事:

  • 新的保留字
  • 新的类/对象后端

大多数 v4 代码在 v5 中运行得很好。 您可能遇到问题的地方是依赖于 v4 类模型限制或利用 v4 参考怪癖的代码。 但大多数人不会根据这些限制进行编码(我有 - 这就是为什么我知道它们在那里)。

如果您受类/对象限制的困扰,您可以在“v1”模式下运行 Zend 引擎,这使得类和对象的行为类似于 v4。 这是有记录的。

Most of the PHP 4/5 compatibility issues are two things:

  • new reserved words
  • new class/object backend

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.

給妳壹絲溫柔 2024-07-24 04:51:43

我认为最好的迁移帮助来自 PHP 人员自己。

I think the best migration help is from the PHP guys themselves.

不知在何时 2024-07-24 04:51:43

我正在进行迁移,发现很多别名问题。

如果您想拥有干净的代码,那么您需要找到适合您的特定代码片段的正确解决方案。 如果清洁度不是那么重要,您可能会发现此功能非常有用:

function php4_clone($object) {
    if (version_compare(phpversion(), '5.0') < 0) {
        return $object;
    } else {
        return @clone($object);
    }
}

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:

function php4_clone($object) {
    if (version_compare(phpversion(), '5.0') < 0) {
        return $object;
    } else {
        return @clone($object);
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文