CodeIgniter 与 PHP 版本的兼容性?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41037434/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 02:18:34  来源:igfitidea点击:

CodeIgniter compatibility with PHP version?

phpcodeigniter-2

提问by jamal

I am using CodeIgniter 2.2.6 with PHP 5.5 and it works fine. Now I want to upgrade PHP to version 5.6.6 my question is, is CodeIgniter compatible with PHP 5.6.6?

我在 PHP 5.5 中使用 CodeIgniter 2.2.6,它工作正常。现在我想将 PHP 升级到 5.6.6 版,我的问题是,CodeIgniter 与 PHP 5.6.6 兼容吗?

I can't upgrade CodeIgniter to a new version because I have many models based on Version 2.2.6.

我无法将 CodeIgniter 升级到新版本,因为我有很多基于 2.2.6 版本的模型。

回答by Vilq

Codeigniter 2.2x IS COMPATIBLE with PHP7.1+.

Codeigniter 2.2x 兼容 PHP7.1+。

You only need to remember:

你只需要记住:

  1. Models/classes and so on are case-sensitive and have to start from capital letter
  2. The same with names of files in application folder
  3. There are problems with mysql (very old, not used now driver) so you have to use mysqli driver (but it is already implemented in CI2, check if you're not using it already)
  4. if you have session table sometimes you'll have to truncate this table, clear cache and populate it again.
  5. Check compatibility of software in third_party folder if you have problems - CI is not responsible for that issues.
  1. 模型/类等区分大小写,必须以大写字母开头
  2. 与应用程序文件夹中的文件名相同
  3. mysql有问题(很老了,现在没用驱动)所以得用mysqli驱动(不过CI2已经实现了,看看你是不是已经在用了)
  4. 如果您有会话表,有时您将不得不截断该表,清除缓存并再次填充它。
  5. 如果您有问题,请检查第三方文件夹中软件的兼容性 - CI 不对这些问题负责。

In my case everything is working smoothly with the newest version of bootstrap & jQuery installed. However, I'm not using hooks, advanced functions and so on.

在我的情况下,安装最新版本的引导程序和 jQuery 后一切正常。但是,我没有使用钩子、高级函数等。

NOTE, that in most cases you can force server to use older php version using .htaccess and AddHandler command:

注意,在大多数情况下,您可以使用 .htaccess 和 AddHandler 命令强制服务器使用较旧的 php 版本:

AddHandler application/x-httpd-php56 .php

This is last version of PHP before PHP7.

这是 PHP7 之前的最后一个 PHP 版本。

And last but not least- of course I don't recommend to use this very old version of CI, however in my opinions - in my cases - there is no sense to migrate from CI2x to CI3, in 2018 it is better to wait for CI4 and then migrate.

最后但并非最不重要的- 当然我不建议使用这个非常旧版本的 CI,但是在我看来 - 在我的情况下 - 从 CI2x 迁移到 CI3 没有意义,在 2018 年最好等待CI4,然后迁移。

回答by Chris

The Server Requirementspage in the user guide says that CodeIngiter 2 requires "PHP version 5.1.6 or newer".

用户指南中的服务器要求页面说 CodeIngiter 2 需要“PHP 5.1.6 或更高版本”。

Note that PHP 5.6 will stop receiving active support in less than a month, so you might want to go right to version 7. PHP 5.6 should receive security patches until the end of 2018.

请注意,PHP 5.6将在不到一个月的时间内停止获得积极支持,因此您可能希望直接升级到版本 7。PHP 5.6 应在 2018 年底之前收到安全补丁。

I can't upgrade CodeIgniter to a new version because I have many models based on Version 2.2.6.

我无法将 CodeIgniter 升级到新版本,因为我有很多基于 2.2.6 版本的模型。

Note also that CodeIgniter 2is no longer supported:

另请注意,不再支持CodeIgniter 2

the current version (2.2.6) came out in October, 2015.

CodeIgniter 2 has reached its end-of-life for support and updates, as of October 31, 2015. No further updates are planned.

We encourage you to upgrade to CodeIgniter 3.x!

当前版本 (2.2.6) 于 2015 年 10 月发布。

截至 2015 年 10 月 31 日,CodeIgniter 2 的支持和更新已结束。没有进一步更新的计划。

我们鼓励您升级到 CodeIgniter 3.x!

There isan upgrade path from version 2.2 to version 3.1, which I encourage you to explore:

这里从2.2版本到3.1版本,我鼓励你去探索的升级路径:

This probably isn't as hard as you think, and with the security implications I believe it's worthwhile.

这可能并不像您想象的那么难,而且我认为这具有安全意义,这是值得的。

回答by Atikrant Upadhye

CI supports php 5.x versions. If want to upgrade your CI project, please Visit https://www.codeigniter.com/userguide3/installation/upgrade_300.html

CI 支持 php 5.x 版本。如果想升级您的 CI 项目,请访问https://www.codeigniter.com/userguide3/installation/upgrade_300.html