3

I am trying to create my own authentication provider like in http://symfony.com/doc/current/cookbook/security/custom_authentication_provider.html.

But, it keeps saying:

ErrorException: Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in /../../vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php line 56

Sukhrob
  • 901
  • 4
  • 12
  • 34
  • I have the same random error with my custom PHP session handler... No idea what it could be. – dAm2K Nov 30 '12 at 23:37

2 Answers2

7

Symfony2 sessions will not work properly with "session auto start" enabled. So make sure that's disabled.

Make sure your php configuration php.ini has this configured: session.auto_start = 0.

Or you can add php_flag session.auto_start 0 to your .htaccess file if you can not edit the php.ini file.

lifo
  • 2,791
  • 1
  • 25
  • 32
0

Additionally, there's one more possibility to get this error, as I found out after a long time of struggling:

For whatever reason, this crucial part was commented out in my config_test.yml, giving me exactly the same error:

framework:
    session:
        storage_id: session.storage.mock_file

The storage_id setting must be in place to avoid the problem.

ahuemmer
  • 1,653
  • 9
  • 22
  • 29