I'm using FOSFacebookBundle in Symfony 2.3 as it says in the Integration with FOSUserBundle documentation. And edited security.yml
, ran the code but I got the error:
Warning: SessionHandler::write(): Parent session handler is not open in /var/www/my/app/cache/dev/classes.php line 407
so I gave the permissions:
sudo chmod 777 -R app/cache
sudo chmod 777 -R app/logs
When I login again, and then logout page I get the same error.
I see this https://github.com/symfony/symfony/issues/5868 and update the php.
But this problem is not solve I don't know why ? Any one know please tell me ?
security.yml
security:
encoders:
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
chain_provider:
chain:
providers: [fos_userbundle, my_fos_facebook_provider]
fos_userbundle:
id: fos_user.user_provider.username
my_fos_facebook_provider:
id: my.facebook.user
firewalls:
main:
pattern: ^/
fos_facebook:
app_url: "http://apps.facebook.com/xxxx/"
server_url: "http://symfony/app_dev.php/login"
login_path: /login
check_path: /loginFb
default_target_path: /
provider: my_fos_facebook_provider
form_login:
login_path: /login
check_path: /login_check
provider: fos_userbundle
logout: true
anonymous: true
access_control:
- { path: ^/secured/.*, role: [IS_AUTHENTICATED_FULLY] }
- { path: ^/.*, role: [IS_AUTHENTICATED_ANONYMOUSLY] }
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
SessionHandler is a special class that can be used to expose the current internal PHP session save handler by inheritance. There are seven methods which wrap the seven internal session save handler callbacks ( open, close , read, write , destroy, gc and create_sid ).
When a plain instance of SessionHandler is set as the save handler using session_set_save_handler () it will wrap the current save handlers. A class extending from SessionHandler allows you to override the methods or intercept or filter them by calls the parent class methods which ultimately wrap the internal PHP session handlers.
A class extending from SessionHandler allows you to override the methods or intercept or filter them by calls the parent class methods which ultimately wrap the internal PHP session handlers.
Your custom session handler should not contain calls to any of the session functions, such as session_name () or session_id (), as the relevant values are passed as arguments on various handler methods. Attempting to obtain values from alternative sources may not work as expected. Here is a wrapper to log in a file each session's operations.
The problem like mentionned in the ticket on github is a bug related to PHP
so there is noting to do in the Symfony2 side.
Consider moving away from your current php 5.4.x
to a newer version.
According to this comming you should be at least using >= php 5.4.11
See this commit
Fast solution could be:
logout:
invalidate_session: false
EDIT:
Be aware session will not be destroyed after logout. I would recommend @Tristan solution.
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