Reputation: 1956
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?
Upvotes: 20
Views: 24670
Reputation: 61
I was having caching issues even when using app_dev.php. I would change a route but it wouldn't update when I tried accessing it via a browser.
I tried commenting out the anything that had cache in it (as stated above). None of that worked.
If I ran the console cache:clear it would fix it, but the next routing change would break again. I had to run cache:clear with every save, which was ridiculous.
My issue turned out that because I was working remotely over SFTP, PHP Storm (my editor) was "preserving timestamp" in its deployment configuration. Once I changed that configuration the issues went away. Apparently there is some caching going on that is looking at the file timestamps, even in the dev environment.
Upvotes: -1
Reputation: 18584
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.
Upvotes: 22
Reputation: 71
Just try to clear the Symfony2 cache with the one (or all) the commands below :
php app/console cache:clear --env=prod --no-debug (on production mode)
or / and
php app/console cache:clear --env=dev --no-debug (on development mode)
Upvotes: 7
Reputation: 2096
Make sure you have defined namespace in your interface SessionHandlerInterface
EX:
namespace app\cache\dev;
Upvotes: 2
Reputation: 1103
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
Upvotes: 14