Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8891209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:40:55+00:00 2026-06-14T22:40:55+00:00

I have a Symfony2 app and I have to read the sessions set from

  • 0

I have a Symfony2 app and I have to read the sessions set from another, non-symfony app.

The non-symfony app just set its sessions into $_SESSION, as usual.

However, when I attempt to read this session, the data isn’t there. No matter I do it by

$session = $this->get('request')->getSession();
var_dump($session->all());

or even (I know I shouldn’t do this, but anyway)

var_dump($_SESSION);

and this gives me session already started error, and I have no idea why there is error despite I have never started session in the Symfony app. Tells me if this way actually work so that I can look into session_start() thing.

$session = new Session();
$session->start();
var_dump($session->all());

The PHPSESSID cookie is set in the Symfony2 app and its value is the same as the cookie set in the non-symfony app, but my Symfony2 app just refuse to read the content of the session. ($session->getName() returns PHPSESSID, to be clear)

(To be exact, both apps are under same domain but different subdomains, and I have already set framework.session.domain correctly in app/config.yml in Symfony app and called session_set_cookie_params on the non-symfony app to have the same domain setting to allow sharing session cookie between subdomains i.e. .example.com)

So how do you read sessions in a Symfony2 app/Controller that is set by a non-symfony app? Thanks.

I am using Symfony 2.1, if this matters.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:40:56+00:00Added an answer on June 14, 2026 at 10:40 pm

    You won’t be able to use the native Symfony2 session wrapper classes because they read session data from app/cache/{env}/sessions/{session_id}, and your non-Symfony2 app isn’t writing its session data to that location.

    You could write a custom session handler in your non-Symfony2 app that writes to that location, or better still you could write a native session handler class in Symfony2 which bypasses the default Symfony2 session read location and gets it from the default PHP session path

    EDIT: Since writing this answer there is now a much more elegant solution available in gadbout’s post below.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read the cookbook regarding deploying my symfony2 app to production environment. I
I have a Symfony2 project with a MySQL db: #app/config/config.yml doctrine: dbal: driver: %database_driver%
I have a Symfony 1.4 app using sfDoctrineGuardPlugin for users. I need to move
I have a symfony project with the followin structure SDCU |-app |-----cache |-----logs |-bin
In Symfony2 (2.0.3) I have a BetaBundle that is set as the parent of
I have a Symfony app that populates the widgets of a portal application and
I have 2 Symfony applications (1 using 1.2.x, another using 1.4.x and both using
I have a console app, (written as a Symfony2 command) that is reading input
I have installed the HerzultFourmBundle into my Symfony2 application, added the calls in the
I have a Symfony2 app representing a restful application that has no need for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.