1. Under CakePHP 2.6.4, the error “Error: Cannot use ‘String’ as class name as it is reserved” is reported, as shown in Figure 1.

2. String is a reserved name in PHP 7.x, so the String class in Cake cannot be used on PHP 7.x. Upgrade to the latest 2.x version and use CakeText instead, as shown in Figure 2.
Reference URL: https://book.cakephp.org/2.0/en/appendices/2-7-migration-guide.html#utility . The String class has been renamed to CakeText, which resolves compatibility issues with HHVM and some conflicts with PHP 7+. A String class is still provided for backward compatibility reasons.

3. Open the URL: https://github.com/cakephp/cakephp/tags and select 2.10.3, as shown in Figure 3.

4. Rename the lib directory in the application directory to lib-2.6.4, as shown in Figure 4.

5. Copy the lib directory from the downloaded package to the application directory, as shown in Figure 5.

6. After a successful upgrade, the error has disappeared and the system runs normally, as shown in Figure 6.

