0

I have this simple code:

<?php

require_once __DIR__.'/../vendor/autoload.php';

$app = new Silex\Application();
$app->get('/hello', function() { return 'Hello!'; });
//$app->register(new Silex\Provider\MonologServiceProvider(), array(
//    'monolog.logfile' => __DIR__.'/development.log',
//));
$app->run();
?>

It works. If I have try to register the Monolog service (removing the 3 beginning '//' comments keywords), nothing works anymore:

$app->register(new Silex\Provider\MonologServiceProvider(), array(
    'monolog.logfile' => __DIR__.'/development.log',
));

I have try the installation through fat zip, and by composer but, same results. I am out of ideas ?

Any help would be appreciated.

Alain
  • 1,450
  • 3
  • 20
  • 37
  • 1
    "Nothing works anymore" is not an good description? What's the error message? Did you check your webserver logs? – Maerlyn Dec 05 '12 at 14:07
  • Where the webserver log should be position ? I probably needs to declare it in php.ini or another config ? – Alain Dec 05 '12 at 14:55
  • Right, webserver logs in /var/log/apache2/error.log. The error was logged there. Configurable in the apache ErrorLog directive. Ha, does newbies ! – Alain Dec 05 '12 at 15:09

1 Answers1

0

Problem solved by extensively tracing the simple code. It appears that the web directory was not writable by the server.

chmod 777 ./web # Solves it

Which bring me to these final questions:

  1. What should be the permissions and ownership of the web directory in a secured production environment ?

    From Maerlyn logs should be contained in a directory apart from the web apis directory.

  2. Where the errors are logged when the log service does not work, or when no log service is registered and we definitely needs the developers attention ? Is there any fallback low low level service ?

    From Maerlyn Look into your web server logs for those type of errors.

Community
  • 1
  • 1
Alain
  • 1,450
  • 3
  • 20
  • 37
  • 1
    You should *not* put your logs under your webroot, that makes it accessible from the outside! Put it at least one level up, my projects have a `log` folder besides `web`, and logs go there. – Maerlyn Dec 05 '12 at 20:38
  • 1
    The lack of errors that you experienced is not at all silex specific. Your web server is running with `display_errors = Off` (which it should in production). By default it will still log into the apache error log. If you are not using `mod_php`, configure the `error_log` directive. – igorw Dec 06 '12 at 01:31