CakePHP is a wonderful PHP framework, but it can be serious pain in the butt when trying to get a multi application setup working. This post is just a simple redirect to a forum thread that solved a problem I had been experiencing for over a month whiles in the testing phase of an app.
The application is basically in two parts:
- /public_html/app <— main application
- /public_html/api <— cross application api
Both apps are running CakePHP 2.4.5 and work extremely well on my local WAMP setup without any issues. The main app makes HTTP requests to the API for virtually all data related calls and in the future the api would be made public via http://api.domain.com and would supply data to a mobile app as well.
The issue however that arose was that as requests are being made, the application would suddenly crash and throw a MissingActionException, with an error like
the action at /controller/action could not be found.
This was strange and after a whole month of researching, the issue all boiled down to the the CakePHP APC cache settings, which were causing a conflict between the two apps, simply because they were using the same value of “myapp_”.
The solution to the problem is recommended here: http://cakephp.1045679.n5.nabble.com/Help-Multiple-Apps-Shared-Core-Dispatch-Errors-CakePHP-2-0-3-td5009614.html
I seriously wonder why the CakePHP team could not come up with a simple process that ensured that with each app on the same system, the $prefix for the Cache.config.prefix setting would be unique, or better yet, force the value to be changed for each app installation so this error does not occur and leave one scratching their head.
Oh well. I’m glad I found that link and hopefully someone else would be spared a month searching for it simply because it is referenced here.