I’ve almost successfully installed CakePHP per your guide at https://book.cakephp.org/3.0/en/installation.html and used composer to create “myapp_test” project folder which I moved to my Apache website folder and set the group/user permissions correctly on the folder and contents (recursively) using chown.
Note, I am using ISPConfig 3.1 on CentOS 7.3. ISPConfig manages all the Vserver Host conf files, so I cannot modify them to set the DocumentRoot as it’s overwritten with any change to the GUI. I tried editing the Vhost file anyway and restarting Apache but it didn’t help matters with the issue below.
I am hitting an issue where I get an error trying to load my Cake test project via the URL. I go to myserver.local/myapp_test/webroot and get this error:
Missing Controller Cake\Routing\Exception\MissingControllerException
Error: Myapp_testController could not be found.
Thoughts? Ideas?
Here’s the Cake error log, the same error is repeating:
2017-08-09 00:23:59 Error: [Cake\Routing\Exception\MissingControllerException] Controller class Myapp_test could not be found.
Exception Attributes: array (
‘class’ => ‘Myapp_test’,
‘plugin’ => NULL,
‘prefix’ => NULL,
’_ext’ => NULL,
)
Request URL: /myapp_test/myapp_test
Stack Trace: #0 /var/www/clients/client2/web2/web/myapp_test/webroot/index.php(36): Cake\Routing\Dispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response)) #1 {main}
I also checked the access_logs for the VHost, maybe it can help?:
172.16.0.10 - - [08/Aug/2017:19:21:52 -0400] “GET /myapp_test/webroot/ HTTP/1.1” 404 32737 “-” "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko"
172.16.0.10 - - [08/Aug/2017:19:21:52 -0400] “GET /myapp_test/debug_kit/js/toolbar.js HTTP/1.1” 304 230 “http ://mysite.local/myapp_test/webroot/” "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko"
172.16.0.10 - - [08/Aug/2017:19:21:52 -0400] “GET /myapp_test/debug_kit/toolbar/9a05a9ef-2653-435c-a2bd-b0b140203e99 HTTP/1.1” 200 4187 “http ://mysite.local/myapp_test/webroot/” "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko"
172.16.0.10 - - [08/Aug/2017:19:21:52 -0400] “GET /myapp_test/debug_kit/img/cake.icon.png HTTP/1.1” 304 231 “http ://mysite.local/myapp_test/debug_kit/toolbar/9a05a9ef-2653-435c-a2bd-b0b140203e99” "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko"
172.16.0.10 - - [08/Aug/2017:19:21:52 -0400] “GET /myapp_test/debug_kit/css/reset.css HTTP/1.1” 304 230 “http ://mysite.local/myapp_test/debug_kit/toolbar/9a05a9ef-2653-435c-a2bd-b0b140203e99” "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko"
172.16.0.10 - - [08/Aug/2017:19:21:52 -0400] “GET /myapp_test/debug_kit/css/toolbar.css HTTP/1.1” 304 231 “http ://mysite.local/myapp_test/debug_kit/toolbar/9a05a9ef-2653-435c-a2bd-b0b140203e99” "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko"
172.16.0.10 - - [08/Aug/2017:19:21:52 -0400] “GET /myapp_test/debug_kit/js/debug_kit.js HTTP/1.1” 304 231 “http ://mysite.local/myapp_test/debug_kit/toolbar/9a05a9ef-2653-435c-a2bd-b0b140203e99” "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko"
172.16.0.10 - - [08/Aug/2017:19:21:52 -0400] “GET /myapp_test/debug_kit/js/toolbar-app.js HTTP/1.1” 304 231 “http ://mysite.local/myapp_test/debug_kit/toolbar/9a05a9ef-2653-435c-a2bd-b0b140203e99” "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko"
172.16.0.10 - - [08/Aug/2017:19:21:52 -0400] “GET /myapp_test/debug_kit/js/jquery.js HTTP/1.1” 304 231 “http ://mysite.local/myapp_test/debug_kit/toolbar/9a05a9ef-2653-435c-a2bd-b0b140203e99” “Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko”
I did, it’s under the screenshot. There is no controller for myapp. Only AppController.php and PagesController.php. This is what was auto-generated by Composer.
Am I missing a step or did Composer not do something?
The reason I was confused is that in the installation it has a section to Fire it up. No mention that it won’t yet work and a controller needs to be created. It may help others to update this with that key bit of info:
Humm, those are pretty complicated examples full of terminology that seems specific to CakePHP.
Are there simpler ones that build up to that to help learn the structure and terminology? This is quite a learning curve. I’m trying to learn because I’m trying to support and modify a legacy app build on CakePHP but figuring out everything is proving difficult because I don’t understand CakePHP well. I found leaning to write a plugin for Wordpress was easier than it is for me to learn CakePHP.
It would really help to have tutorials that start with a basic Hello World, add some components like links, add a form, etc., and not use cake specific language without explaining those terms.
If you have found your solution with my answers then make sure you change the Title of you topic to
CakePHP 3.x error about Controller missing after default project created [Solved]
It will save time of those who are here to answer to people’s question.