-2

How can we migrate cakephp 2.x application to PHP 7.x?

I have a cakePHP based application, which is built in cakePHP 2.9

How can I migrate this to PHP 7.x

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
  • According the the [dcumentation](https://book.cakephp.org/2.0/en/installation.html#requirements) - *CakePHP version 2.8.0 and above support PHP 7* – Nigel Ren Sep 16 '19 at 06:59
  • But still I am getting an issue Fatal error: Cannot use 'String' as class name as it is reserved in C:\xampp\htdocs\jobsite\site\lib\Cake\Utility\String.php on line 26 – Voizac Technologies Sep 16 '19 at 07:36
  • Does https://stackoverflow.com/questions/52981403/cannot-use-object-as-class-name-as-it-is-reserved-cake-2-2-x help for this problem? – Nigel Ren Sep 16 '19 at 09:00
  • Is there anything not working when simply using a current PHP version with your existing application? Then please share the details by editing your question – Nico Haase Apr 30 '20 at 18:45

1 Answers1

0

Search for references to String in your own application code.

For instance with CakePHP 2.10 on PHP 7.2, the following code gives me the same error:

App::uses('String', 'Utility');
App::load('String');

Not only the framework version you use must be compatible with PHP 7, but your own application code must be too. For this particular case, replace the occurences of the deprecated String class by CakeText, and it should do the trick.

nIcO
  • 5,001
  • 24
  • 36