Upgrade cakephp 2 app -> cakephp 3 app, `Cannot declare App because the name is already in use`


I am having a problem when attempting to upgrade my cakephp 2 app to cakephp 3.

I am using PHP 7.1 & Ubuntu 16 and nginx/1.10.0 (Ubuntu)

I am getting the following error...

Fatal error: Cannot declare class lib\Cake\Core\App because the name is already in use in /usr/share/nginx/html/web/lib/Cake/Core/App.php on line 70

I am following this page: https://github.com/cakephp/upgrade

I am first using these commands:

bin/cake upgrade locations [path]
bin/cake upgrade namespaces [path]
bin/cake upgrade app_uses [path]

bin/cake upgrade rename_classes [path]
bin/cake upgrade rename_collections [path]
bin/cake upgrade method_names [path]
bin/cake upgrade method_signatures [path]
bin/cake upgrade fixtures [path]
bin/cake upgrade tests [path]
bin/cake upgrade i18n [path]
bin/cake upgrade skeleton [path]
bin/cake upgrade prefixed_templates [path]

Some more details:

My php version is (output of php -v) is:

PHP 7.1.0-5+deb.sury.org~xenial+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.1.0-5+deb.sury.org~xenial+1, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans

and my ubuntu version (output of lsb_release -a) is:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:    16.04
Codename:   xenial

Show source
| cakephp   | php   | cakephp-3.0   | cakephp-2.0   | php-7   2017-01-05 18:01 1 Answers

Answers ( 1 )

  1. 2017-01-06 03:01

    Looks like you might have CakePHP on an include_path or have otherwise installed the upgrade plugin in a way that isn't composer install inside the upgrade plugin. Unless you've cloned the upgrade tool into /usr/share/nginx/html/web/.

◀ Go back