1

i have two laravel project in the same server i use auth for all projects. When i login to project1 and then i login in to project2 my project1 will be log out. How can i login to all project by avoid session conflict??

in my project1 i keep default path=>'/'

i try to change config/session in project2 by change path => '/' to path=>'/new'

but it still not working.. Any solution for this

Heshan
  • 51
  • 1
  • 6
  • 1
    Possible duplicate of [Multiple Laravel 5 projects on the same domain](https://stackoverflow.com/questions/37193079/multiple-laravel-5-projects-on-the-same-domain) – Devon Bessemer Jun 26 '17 at 15:27
  • Or https://stackoverflow.com/questions/32647464/session-conflicts-with-multiple-laravel-projects-on-one-server – DevK Jun 26 '17 at 15:28
  • @devk when i change path project 2 i can't login – Heshan Jun 26 '17 at 15:31
  • @Devon also change cookie?? – Heshan Jun 26 '17 at 15:33
  • Yes, as the session path of `/` would still create problems for `/new` just like `/new` would conflict with `/new/deeper` – Devon Bessemer Jun 26 '17 at 15:35
  • @Devon can you show me your answer please – Heshan Jun 26 '17 at 15:37
  • Are both projects in the same virtual host? (how does that even work?) – apokryfos Jun 26 '17 at 15:45
  • @apokryfos so we should create new virtual host?? – Heshan Jun 26 '17 at 15:47
  • If you have `subdomain1.example.com` and `subdomain2.example.com` there wouldn't be any crossover between sessions/cookies which is what seems to be the problem here. – apokryfos Jun 26 '17 at 15:48
  • @apokryfos i only test it in my local machine with xampp – Heshan Jun 26 '17 at 15:51
  • @apokryfos http://localhos/project1/login – Heshan Jun 26 '17 at 15:52
  • @apokryfos and http://localhost/project2/login – Heshan Jun 26 '17 at 15:52
  • @apokryfos when i change session path in project2 i can't login – Heshan Jun 26 '17 at 15:54
  • The problem is if you set the session path in the config, you're setting it for both projects (which is bad). Best idea is to check out https://stackoverflow.com/questions/27268205/how-to-create-virtual-host-on-xampp or https://stackoverflow.com/questions/27754367/how-to-set-up-apache-virtual-hosts-on-xampp-windows – apokryfos Jun 26 '17 at 15:54
  • There's no way around it. If you want to use the exact same code for 2 different sites but still be able to differentiate then there must be a way to differentiate. Absolute worse case would be to "hack" the core `index.php` and set an environment variable based on the current `/path`, but vhost is the suggested way. – apokryfos Jun 26 '17 at 15:58
  • @apokryfos okk i try it thank for your idea – Heshan Jun 26 '17 at 16:00
  • @apokryfos how can i access to my project from another PC in LAN example: when i type project1.dev it's not working – Heshan Jun 27 '17 at 03:47
  • @Heshan first of all ensure that you can access that PC by its IP (e.g. 192.168.1.X) and then [modify your hosts file](https://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/) on the other PC to point `project1.dev` to that IP. – apokryfos Jun 27 '17 at 06:39

0 Answers0