SessionHandler::write(): Parent session handler is not open

4.9k views Asked by At

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 }
2

There are 2 answers

0
sf_tristanb On BEST ANSWER

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

0
Jekis On

Fast solution could be:

logout:
    invalidate_session: false

EDIT:

Be aware session will not be destroyed after logout. I would recommend @Tristan solution.