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

  • SEARCH
  • Home
  • 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 6541033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:03:16+00:00 2026-05-25T11:03:16+00:00

I have 2 different domain, let’s call them www.foo.com and bar.foo.com. The first one

  • 0

I have 2 different domain, let’s call them http://www.foo.com and bar.foo.com. The first one is built with CI, and the second one is built with Symfony. I want to share my session, so if I login in one of them, I can access the other one. I set my session data with $_SESSION["session_name"] = "value";.

How to make a session data readable from the other domain?

Thanks for your help.

  • 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-05-25T11:03:16+00:00Added an answer on May 25, 2026 at 11:03 am

    Considering your original question and your answers to Logan and myself in the comments of the original question I understand:

    1 – you want to pass the session variables among a domain and its subdomains; and

    2 – CI and Symfony load the session before you have a chance to do the ini_set command.

    I believe you have two options:

    1 – include the php configuration command in the php.ini file

    session.cookie_domain=".foo.com"
    

    If you try including it in the .htaccess it will not work if you are running php as a CGI module, which seems to be fairly common among shared hosting services.

    2 – you can prepend a file to all php scripts in your site. Those will be put on top of every single php script your site runs, even the ones inside CI and Symfony. For example:

    phpprepend.php file

    <?php
    ini_set('session.cookie_domain', '.foo.com');
    ?>
    

    include the following line in your php.ini file:

    auto_prepend_file = "/path/to/file/phpprepend.php"
    

    Please let us know if this solves the problem.

    Good luck!

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

Sidebar

Related Questions

I have a domain... let's say www.myOldDomain.com. It is currently running a site about
I have a web-server, that serves different domain-names, but has only one IP-address assigned.
I have two domains, one is a .com domain and the other is a
We have a site that is public facing, let's say it's http://www.example.com . When
I would like to have different applications under the same domain using Heroku. Because
i have two .net web application and they ara running on different domain same
I have an iframe. I am setting the content of the iframe (different domain
I have an application with different sections. Each section is accessed through a domain.
I have several sites in different domains: example.com , example.org , mail.example.com and passport.example.org
i have a (php) wordpress site on let's say domain1.com and i bought another

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.