CakePHP says An Internal Error Has Occurred.

Recently I had the wonderful experience of CakePHP informing me that “An Internal Error Has Occurred”, with no more indication of what the problem could be. After digging around the CakePHP code I quickly found out that this code is pretty much used for any 500 browser error.  So I started the process of elimination:

  1. The site was working correctly.  I know this because most pages on the site came up just fine.  The error was only on certain pages.
  2. It was not caused by the page not existing on the server.  The controller, action, and models were all named correctly.  I know this because the page was working correct a week ago, and because I did a sanity check to ensure nothing had changed in this area.
  3. I checked to ensure the .htaccess had not been deleted, changed, or renamed.  All was OK here.
  4. I checked the CakePHP logs.  These exist in the ‘app/tmp/logs/’ directory.  There were NO errors reported, and no debug entries as well.
  5. I checked the /var/log/messges’ and found no errors reported there.
  6. I checked the /var/apache2/{log_file_name}’ and found no errors there.

Everything should have been working, according to the settings and log files, so why was I still receiving this internal error message?

How I solved it:

Finally, I got tired of playing around and simply edited the CakePHP code to output $params array to see the raw reason for the error.  I did this by editing the ‘cake/libs/error.php’ file and adding the following around line 176 in the “error500” function as the first two lines as follows:

print_r($params);
die();

This gave me a simple array that clearly informed me I was missing a table in the DB that was deprecated. From there I quickly found the entry in the model that was still trying to link to the deprecated table. I cleaned up the offending model, and now all is well with the world again.

Comments

17 responses to “CakePHP says An Internal Error Has Occurred.”