Last Updated: February 25, 2016
·
6.436K
· yeco

Fix for CakePHP error: Fatal error: Class ‘Router’ not found in xxxx

Let me guess, you just moved servers or directories, right? Fortunately it’s an easy fix.

Cake keeps caches of computationally expensive data in order to reduce CPU and memory use and speed your applications up. The downside is occasionally, such as after a server move, Cake caches something you really don’t want cached. In this case the absolute pathname to the CakePHP router.php file.

Fortunately the solution is easy. Just clear your cache by deleting all the files in tmp/cache and tmp/cache/models. The problem should instantly be gone.

3 Responses
Add your response

Did not work

over 1 year ago ·

Did not work for me either. Where else does cake cache stuff? What calls the router::connect method in routes.php?

over 1 year ago ·

You are missing a use statement. Because CakePHP 3.0 uses namespaces, you have to either use the fully namespaced classname Cake\Routing\Router or add use Cake\Routing\Router to the top of your view file.

https://github.com/cakephp/cakephp/issues/3909

over 1 year ago ·