8

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?

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

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
jamal
  • 183
  • 1
  • 3
  • 15
  • it should be okay; these are the b.c: http://php.net/manual/en/migration56.incompatible.php – Federkun Dec 08 '16 at 10:44
  • 2
    I removed the backticks (`\``) from your question. These shouldn't be used for emphasis; they indicate things like inline code snippets or file names. – ChrisGPT was on strike Dec 08 '16 at 12:43
  • Why not try it out and see what happens? If you are facing any **specific** problem with your application, share more details – Nico Haase Feb 15 '23 at 11:57

2 Answers2

5

Codeigniter 2.2x IS COMPATIBLE with 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.

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.

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

AddHandler application/x-httpd-php56 .php

This is last version of PHP before PHP7.

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.

Vilq
  • 567
  • 6
  • 11
  • Thank you for this answer. This worked for me with PHP7.2 and CodeIgniter 2.2.6 on Ubuntu 18.04. I was moving an old project to this new installation. – itsols Jul 17 '18 at 16:51
  • I have a question regarding this, https://stackoverflow.com/questions/51550305/cannot-redeclare-codeigniter-helper-class, do you think my code igniter version with php 7.0 is the issue? – Joseph Astrahan Jul 27 '18 at 03:31
  • Try to check if you're using older MYSQL or newer MYSQLI connection. In most cases this is a problem. – Vilq Aug 06 '18 at 12:51
4

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

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.

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

Note also that CodeIgniter 2 is no longer supported:

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!

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

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

Community
  • 1
  • 1
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • I know how to upgrade, but the problem is that i have about 100 MIS which in one core file of codeigniter and have Billion line of codes which is based on PHP 5.4 now i cant upgrade it really, and my question is, is codeigniter 2.2.6 is compatible with PHP 5.6.6 or not ? – jamal Dec 09 '16 at 03:15
  • @jamal, as indicated in my question the official documentation simply claims "5.1.6 or later". Since PHP 5.6 was released in 2014, before CodeIgniter 2 stopped receiving updates, I expect that it does run on that version. Why not try it and see? But please don't underestimate the importance of upgrading both PHP and CI. There are security implications if you keep using old versions. – ChrisGPT was on strike Dec 09 '16 at 03:20