Thomas thomas
Thomas thomas

Reputation: 795

Silex doctrine and debugging

I m actually building an application with silex and doctrine.

Actually, in developpment mode in works great and I can access my database.

The fact is now I changed my db information to match with my OVH mysql.

Now, when I try to start my application on my OVH domain, I got

Whoops, looks like something went wrong.

And nothing else.

I don't know at all how to get more informations about it and can't find any working solution to log the detail of the failing state.

Thanks for you help

Upvotes: 1

Views: 579

Answers (1)

chalasr
chalasr

Reputation: 13167

In order to make it works, enable the debug :

use Symfony\Component\HttpKernel\Debug\ErrorHandler;
use Symfony\Component\HttpKernel\Debug\ExceptionHandler;

// Set the error handling
ini_set('display_errors', 1);
error_reporting(-1);

ErrorHandler::register();

if ('cli' !== php_sapi_name()) {
    ExceptionHandler::register();
}

$app = new Silex\Application();
$app['debug'] = true

$app->run();

You can also catch exceptions like follows :

$app->error(function(\Exception $e) use ($app) {
    print $e->getMessage(); // Do something with $e
};

Upvotes: 1

Related Questions