I has problem with Symfony2. All work fine, and one day... start the problems ...
When i open a page, i get error 500. The server return this error, not Symfony. If i refresh, I display display the page without error. But when i open a new page (new url, same site), the error come again.
I tried to reload apache. I tried remove all in cache and logs. My console file, app.php file, app_dev.php file have umask(0000) uncommented.
This is the last line of symfony2 logs when i have the error :
[2015-09-04 11:20:57] event.DEBUG: Notified event "kernel.response" to listener "JMS\I18nRoutingBundle\EventListener\CookieSettingListener::onKernelResponse". [] []
[2015-09-04 11:20:57] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\Security\Http\Firewall\ContextListener::onKernelResponse". [] []
[2015-09-04 11:20:57] security.DEBUG: Write SecurityContext in the session [] []
[2015-09-04 11:20:57] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bridge\Monolog\Handler\FirePHPHandler::onKernelResponse". [] []
[2015-09-04 11:20:57] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bridge\Monolog\Handler\ChromePhpHandler::onKernelResponse". [] []
[2015-09-04 11:20:57] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ResponseListener::onKernelResponse". [] []
[2015-09-04 11:20:57] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\EsiListener::onKernelResponse". [] []
[2015-09-04 11:20:57] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\Security\Http\RememberMe\ResponseListener::onKernelResponse". [] []
[2015-09-04 11:20:57] event.DEBUG: Notified event "kernel.response" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener::onKernelResponse". [] []
[2015-09-04 11:20:57] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelResponse". [] []
[2015-09-04 11:20:57] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener::onKernelResponse". [] []
[2015-09-04 11:20:57] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\SaveSessionListener::onKernelResponse". [] []
[2015-09-04 11:20:57] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\StreamedResponseListener::onKernelResponse". [] []
[2015-09-04 11:20:57] event.DEBUG: Notified event "kernel.terminate" to listener "Symfony\Bundle\SwiftmailerBundle\EventListener\EmailSenderListener::onTerminate". [] []
The apache error log :
[Fri Sep 04 11:24:49 2015] [error] [client my.ip.here] Premature end of script headers: app_dev.php
The problem does not exist in prod, when i use app.php
The syslog does not have line about this. I don't have problem on other website on the same server. I don't have hard drive space problem.
Anyone have an idea ? thx
The app_dev.php file :
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
umask(0000);
// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'xxx.xxx.xxx.xxx'))
) {
header('HTTP/1.0 403 Forbidden');
exit($_SERVER['REMOTE_ADDR'].' : You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
Debug::enable();
require_once __DIR__.'/../app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
For apache configuration, it's isp config configuration, i just added this for this website :
Apache directive :
DocumentRoot /var/www/clients/client2/web56/web/symfony/web/
FcgidMaxRequestLen 20000000
php.ini :
apc.shm_size = 256M
realpath_cache_size = 4096k
realpath_cache_ttl=7200
session.auto_start = 0
xdebug.remote_autostart=0
xdebug.remote_enable=0
xdebug.profiler_enable=0
In config_dev.yml, if I remove firephp and chromephp from monolog configuration, the problem is solved. I don't think it's good solution, anyone have an other idea ?
I have commented firephp and chromephp in config_dev.yml :
imports:
- { resource: config.yml }
framework:
router:
resource: "%kernel.root_dir%/config/routing_dev.yml"
strict_requirements: true
profiler: { only_exceptions: false }
web_profiler:
toolbar: true
intercept_redirects: false
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
# firephp:
# type: firephp
# level: info
# chromephp:
# type: chromephp
# level: info
assetic:
use_controller: true
#swiftmailer:
# delivery_address: [email protected]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With