CakePHP Error: Internal Error Occurred

I have some code in cakephp that causes an error.

Here is the PHP controller:

$this->loadModel( 'Vote' ); //Newly added by amit start $vote=$this->Vote->getVote($id,$uid); $this->set('vote',$vote); $voteCount = count($vote); $this->set('voteCount',$voteCount); $voteShow = $this->Vote->find('all', array( 'fields' => array('SUM(Vote.score) AS score','count(id) as countId'), 'conditions'=>array('Vote.type_id'=>$id), )); $this->set('voteShow',$voteShow); 

model:

 public function getVote($id,$uid) { if (empty($conditions)) $conditions = array('Vote.type' => 'blog', 'Vote.type_id' => $id, 'Vote.user_id' => $uid); $users = $this->find('all', array('conditions' => $conditions, 'order' => 'Vote.id desc' )); return $users; } 

This code causes this error:

 Error : An internal error has occurred 

What does this error mean?

+6
source share
3 answers

I turned on debugging mode: Configure::write('debug', 2); in core.php and it solved my problem.

+9
source

In my case, the debugging mode was Configure::write('debug', 0); on a live server in core.php.

I set it to Configure::write('debug', 1); , and this time the error was not shown.

So, I again changed the debugging mode to Configure::write('debug', 0); because I donโ€™t want to show debugging error on my live site.

This time the error message does not appear.

So, just by changing the debug mode once in core.php , get rid of this error in my case.

If you change the debug mode to 1 and then run the functions that you changed on the local one, CakePHP will update the cache for all the models that are included in these functions. Now you can return to Configure::write('debug', 0) .

+4
source

DO NOT install Configure::write('debug',2) during production, otherwise you may write sensitive data (such as Query) to the user when an error occurs, the reason Debug 2 works is because the elements in CACHE not accepted in anymore, so it works. Just delete the cache and leave DEBUG set to 0 in production. VERY IMPORTANT

The cache can be found here: tmp/cache/

Then again, DO NOT delete the 3 folders that you find there, just delete their contents.

+3
source

Source: https://habr.com/ru/post/959087/


All Articles