0

Im using plugin, I want just to load data from my table as json, the problem is in local it's working and in the server I found this error in log :

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log.

my model:

<?php
class Indisponibilite extends AppModel {

    var $name = 'Indisponibilite';

}

my function:

public function getIndisponible () {

    $indisponibles = ClassRegistry::init('Indisponibilite')->find('all');

    echo json_encode($indisponibles);

    $this->layout = 'ajax';  
    $this->autoRender = false;
    $this->render(false, "ajax");
    error_reporting(0);

}
ndm
  • 59,784
  • 9
  • 71
  • 110
Fredj
  • 59
  • 2
  • 9
  • 1
    As the error message suggests, check [**the server error log**](http://stackoverflow.com/q/6438475/1392379) (**http://stackoverflow.com/q/5127838/1392379**). Side note, controller actions [**shouldn't echo data**](http://stackoverflow.com/a/43147620/1392379)! – ndm May 02 '17 at 11:31

1 Answers1

0

First of all: Please check the docs about JSON Views which are much more MVC and Cake-ish. For Cake 2.x check here.

Also, don’t set error_reporting. CakePHP should handle all this for you. Setting Configure::write('debug', 0) will turn off error_reporting for you.

To find your error, check the logs, turn on debug and see what’s up there.

Marijan
  • 1,825
  • 1
  • 13
  • 18
  • my application on server now, I cant find the log error.. where I can find it please ! – Fredj May 02 '17 at 12:54
  • This strongly depends on your server setup, probably in a folder `log`. The CakePHP `error` and `debug` logs can be found in `/logs`. Is the action you described the only one that’s not working? – Marijan May 02 '17 at 13:08
  • yes it's only not working when I call that model I found Internal Server Error ! – Fredj May 02 '17 at 14:14