Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony 2 - Fatal error: Cannot redeclare class SessionHandlerInterface in C:\...\app\cache\dev\classes.php on line 532

Tags:

php

symfony

After reinstalling my wamp environment this error message is showing on screen after I open app_dev.php:

Fatal error: Cannot redeclare class SessionHandlerInterface in C:...\app\cache\dev\classes.php on line 532

Does anyone have any clue what is going wrong?

like image 529
Egel Avatar asked Feb 04 '13 14:02

Egel


3 Answers

I solved it clearing the cache:

app/console cache:clear
like image 72
Gerardo Avatar answered Oct 28 '22 03:10

Gerardo


PHP version 5.4 introduced a new session management system based on an interface called SessionHandlerInterface and it would seem that your Symfony2 code declares a class with the very same name in the global namespace, so there is a name clash.

Here are the docs: http://www.php.net/manual/en/class.sessionhandlerinterface.php

SessionHandlerInterface is an interface which defines a prototype for creating a custom session handler. In order to pass a custom session handler to session_set_save_handler() using its OOP invocation, the class must implement this interface.

like image 22
Matteo Tassinari Avatar answered Oct 28 '22 05:10

Matteo Tassinari


The simple clear cache didn't work for me. It required that the production cache be cleared using the command below.

php app/console cache:clear --env=prod --no-debug
like image 14
Scott Daniel Avatar answered Oct 28 '22 05:10

Scott Daniel