app_dev.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. use Symfony\Component\HttpFoundation\Request;
  3. use Symfony\Component\Debug\Debug;
  4. // Need to trace all kind of errors
  5. error_reporting(-1);
  6. ini_set('display_errors', 'On');
  7. // If you don't want to setup permissions the proper way, just uncomment the following PHP line
  8. // read http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup
  9. // for more information
  10. umask(0000);
  11. // This check prevents access to debug front controllers that are deployed by accident to production servers.
  12. // Feel free to remove this, extend it, or make something more sophisticated.
  13. /*if (isset($_SERVER['HTTP_CLIENT_IP'])
  14. || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
  15. || !(in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server')
  16. ) {
  17. header('HTTP/1.0 403 Forbidden');
  18. exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
  19. }*/
  20. /**
  21. * @var Composer\Autoload\ClassLoader $loader
  22. */
  23. $loader = require __DIR__.'/../app/autoload.php';
  24. Debug::enable();
  25. // Classic
  26. /*$kernel = new AppKernel('dev', true);
  27. $kernel->loadClassCache();
  28. $request = Request::createFromGlobals();
  29. $response = $kernel->handle($request);
  30. $response->send();
  31. $kernel->terminate($request, $response);*/
  32. require_once __DIR__.'/../app/AppKernel.php';
  33. //require_once __DIR__.'/legacy.php';
  34. //$request = Request::createFromGlobals();
  35. $kernel = new AppKernel('dev', true);
  36. $kernel->loadClassCache();
  37. $request = Sonata\PageBundle\Request\RequestFactory::createFromGlobals(
  38. 'host_with_path'
  39. );
  40. $response = $kernel->handle($request);
  41. $response->send();
  42. $kernel->terminate($request, $response);