Cakephp prefix routing (plugin) not working on Linux - but works on Windows

I have a CakePHP 3 app and it has different plugins. The plugins appear to load and accessing them on a dev Windows machine, WAMP, it all works fine.

Once on the CentOS server, the plugin’s prefix routing eg ‘admin’ stops working, getting a missing controller error:
enter image description here

2018-04-11 12:40:23 Error: [Cake\Routing\Exception\MissingControllerException] Controller class Contacts could not be found.
Exception Attributes: array (
  'class' => 'Contacts',
  'plugin' => 'Contacts',
  'prefix' => 'admin',
  '_ext' => NULL,
)
Request URL: /myapp/contacts/admin/contacts
Referer URL: https://***/myapp/anotherplugin/participants
Stack Trace:
#0 /srv/www/myapp/myapp-app/webroot/index.php(36): Cake\Routing\Dispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#1 /srv/www/myapp/myapp-app/index.php(16): require('/srv/www/mya...')
#2 {main}

Non-prefix routing seems fime. The plugins are added in bootstrap.php like this:

Plugin::load('Contacts', ['bootstrap' => false, 'routes' => true]);

In plugins routing file:

<?php
use Cake\Routing\Router;

Router::plugin('Contacts', function ($routes) {
    $routes->fallbacks('InflectedRoute');
});

Router::plugin('Contacts', function ($routes) {
    $routes->prefix('admin', function ($routes) {
        $routes->fallbacks('InflectedRoute');
    });
});

In Apache the app is setup as an alias with mod rewrite - both on WAMP and on the CentOS server:

http://server-or-localhost/myapp/

Differences between local and server:

  • Server is Linux, uppercase/lower case issues?
  • Same PHP versions, but
    maybe some modules missing on server PHP?
  • The server redirects http to https

Almost certainly case-sensitivity issue. Check that the controller filename is exactly ContactsController.php

Blast! It was a bug in CakePHP 3.2.0 and addressed in CakePHP 3.2.1.
https://bakery.cakephp.org/2016/01/30/cakephp_3110_and_321_released.html
Doh!

Haha, or that :slight_smile:

Always install the latest patch version!

Yea, but the dev staff told me to use CakePHP 3.2 specifically. Which was strange because we are on 3.3+ on our other apps. Was it a prank? The guy then says it’s a system/server issue, nothing to do with him.