How do I upgrade cake php from 2.8.3 to the version 5

Hello,
I’m trying to migrate page using cake php to a new server, which is also using up to date version of php.
Based on the error messages and search, it seems like I can’t use 2.8.3 version anymore as it won’t work in the 8+ version of php.
So I would like to find an easy way to update the cake boilerplate files while keeping the app intact as much as possible.

I tried to find a way how to download new files so I can just replace them on the server, but it doesn’t seem to be possible. I tried to use the composer, but it also doesn’t work as it seems like it is using php to actually do the work, which won’t really work due to access rights (php can write only to specific folders, not to just any folder).

The question is, how do I just obtain the cake lib files for the version 5, which I could just use to replace the old cake library?

P.S. I would be the most happy if there would be some kind of patch to make the current version of cake working in new version of php, so i wouldn’t have to update, isn’t it possible?

Updating a Cake 2 app to Cake 5 can be a significant amount of work, depending on the size of the app. You will have to manually rewrite a lot of it.

If you just want to get the Cake 2 app running on PHP 8+ you can use this community fork (and update your app’s code to be PHP 8+ compatible).

The easy way would have been if you kept up with the changes which have happened over the past 9 years since 2.8.3 has been released

TLDR: You can’t just expect to upgrade CakePHP 2 to CakePHP 5 since just the jump from 2 to 3 had a lot of breaking changes. E.g. a completely new ORM was introduced in CakePHP 3

I’d recommend you start a fresh CakePHP 5 app, bake the boilerplate files with bake as you know it, and manually port over the functionality you need.

CakePHP 2 has been EOL’d (end of life) in 2021. See CakePHP 2.x End of Life — Bakery

But as ADmad already said there are community forks of CakePHP 2 which support newer PHP Versions. But this is still not a long term solution for your app.

I would say it is a matter of size and customization.
How large is the app (controllers, models, ..), how much did you deviate from (baked) default ways of coding. Those will large determine the time (=money) it will need to rewrite it.

Hello, the fork would be exactly the best, as I don’t really want to port all the code. I mainly want to get it working on a new hosting, so I can start making new version of the site alongside the old one using the same database, so the switch could be gradual.

The only problem I see is, that the fork states this:

This fork is based on CakePHP 2.10.24. Earlier versions are not supported.

But the current version of the cakephp is 2.8.3, so it seems like the fork doesn’t support my version.

Well as per semantic versioning there was no breaking change between CakePHP 2.8 and 2.10, only new features were added. So you should have no problems running latest 2.10.24 with your codebase as well.