FriendsOfSymfony / FOSFacebookBundle

NOT MAINTAINED - see https://github.com/hwi/HWIOAuthBundle
322 stars 140 forks source link

RuntimeException: Failed to start the session because headers have already been sent. #261

Closed lukeman83 closed 11 years ago

lukeman83 commented 11 years ago

Hi, I integrated FOSUserBundle, FOSFacebookBundle, FOSRestFulBundle and others Bundles ant that's all right! Now I'm trying to integrate NelmioApiDocBundle but there is a problem in the FOSFacebookBundle. The error is:

RuntimeException: Failed to start the session because headers have already been sent.

at Session->start() in /home/project/domains/project.com/public_html/project_dev/vendor/friendsofsymfony/facebook-bundle/FOS/FacebookBundle/Facebook/FacebookSessionPersistence.php line 28

Baachi commented 11 years ago

Can you post the stacktrace?

lukeman83 commented 11 years ago

Whoops, looks like something went wrong.

1/1RuntimeException: Failed to start the session because headers have already been sent. in /home/project/domains/project.com/public_html/project/app/cache/dev/classes.php line 180 at NativeSessionStorage->start() in /home/project/domains/project.com/public_html/project/app/cache/dev/classes.php line 786 at Session->start() in /home/project/domains/project.com/public_html/project/vendor/friendsofsymfony/facebook-bundle/FOS/FacebookBundle/Facebook/FacebookSessionPersistence.php line 28 at FacebookSessionPersistence->__construct(array('appId' => '519235104772246', 'secret' => 'be3a21787432ca512cae513cdc0c6b38', 'cookie' => true, 'domain' => null), object(Session)) in /home/project/domains/project.com/public_html/project/app/cache/dev/appDevDebugProjectContainer.php line 1043 at appDevDebugProjectContainer->getFosFacebook_ApiService() in /home/project/domains/project.com/public_html/project/app/bootstrap.php.cache line 211 at Container->get('fos_facebook.api') in /home/project/domains/project.com/public_html/project/app/cache/dev/appDevDebugProjectContainer.php line 5302 at appDevDebugProjectContainer->getSecurity_Authentication_ManagerService() in /home/project/domains/project.com/public_html/project/app/bootstrap.php.cache line 211 at Container->get('security.authentication.manager') in /home/project/domains/project.com/public_html/project/app/cache/dev/appDevDebugProjectContainer.php line 3229 at appDevDebugProjectContainer->getSecurity_ContextService() in /home/project/domains/project.com/public_html/project/app/bootstrap.php.cache line 211 at Container->get('security.context') in /home/project/domains/project.com/public_html/project/app/cache/dev/appDevDebugProjectContainer.php line 3051 at appDevDebugProjectContainer->getProfilerService() in /home/project/domains/project.com/public_html/project/app/bootstrap.php.cache line 211 at Container->get('profiler') in /home/project/domains/project.com/public_html/project/app/cache/dev/appDevDebugProjectContainer.php line 3069 at appDevDebugProjectContainer->getProfilerListenerService() in /home/project/domains/project.com/public_html/project/app/bootstrap.php.cache line 211 at Container->get('profiler_listener') in /home/project/domains/project.com/public_html/project/app/cache/dev/classes.php line 5047 at ContainerAwareEventDispatcher->lazyLoad('kernel.exception') in /home/project/domains/project.com/public_html/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ContainerAwareTraceableEventDispatcher.php line 174 at ContainerAwareTraceableEventDispatcher->lazyLoad('kernel.exception') in /home/project/domains/project.com/public_html/project/app/cache/dev/classes.php line 5031 at ContainerAwareEventDispatcher->dispatch('kernel.exception', object(GetResponseForExceptionEvent)) in /home/project/domains/project.com/public_html/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ContainerAwareTraceableEventDispatcher.php line 78 at ContainerAwareTraceableEventDispatcher->dispatch('kernel.exception', object(GetResponseForExceptionEvent)) in /home/project/domains/project.com/public_html/project/app/bootstrap.php.cache line 1463 at HttpKernel->handleException(object(RuntimeException), object(Request), '1') in /home/project/domains/project.com/public_html/project/app/bootstrap.php.cache line 1396 at HttpKernel->handle(object(Request), '1', true) in /home/project/domains/project.com/public_html/project/app/bootstrap.php.cache line 1566 at HttpKernel->handle(object(Request), '1', true) in /home/project/domains/project.com/public_html/project/app/bootstrap.php.cache line 617 at Kernel->handle(object(Request)) in /home/project/domains/project.com/public_html/project/web/app_dev.php line 30

Baachi commented 11 years ago

You have a site which prints anything before symfony is booted or the session is started. Check that each file starts with <?php.

lukeman83 commented 11 years ago

Maybe NelmioApiDocBundle starts before all Bundles and FOSFacebookBundle try to reopen the same session?

Baachi commented 11 years ago

No, the NelmioApiDocBundle does not deal with the session component.

lukeman83 commented 11 years ago

I have this problem only on the server-side. I don't have it i local-side.

lukeman83 commented 11 years ago

Perfect!!! My AppKernel.php started with /<?php Many thanks!