简体   繁体   English

localhost PHP Web应用程序上的会话问题

[英]Session issues on localhost PHP Web Applications

So I recently clean installed Windows 10 on my laptop and began setting up my dev environment. 因此,我最近在笔记本电脑上清洁了Windows 10的安装,并开始设置我的开发环境。 I am currently working on 2 PHP applications built on top of Codeigniter, one is hosted in local XAMPP install and the other uses vagrant to provision a centos 7 VM with Apache, MySQL, PHP, Redis etc. The site running on local XAMPP install is accessable via http://localhost and the other is accessed through a domain setup in the hosts file to route the domain to the IP of the VM. 我目前正在研究2个基于Codeigniter构建的PHP应用程序,一个驻留在本地XAMPP安装中,另一个使用流浪汉通过Apache,MySQL,PHP,Redis等配置centos 7 VM。在本地XAMPP安装上运行的站点是可通过http:// localhost访问,另一个可通过hosts文件中的域设置访问,以将域路由到VM的IP。

Here comes the issues, I can access both sites and everything appears to work as intended until I go to login to the sites and begin to use session data. 问题来了,我可以访问两个站点,并且一切似乎都按预期进行,直到我登录到站点并开始使用会话数据。 For example, in the $_SESSION array I store login data and every time I login the data gets set but doesn't persist to the next page load. 例如,在$ _SESSION数组中,我存储登录数据,并且每次登录时都会设置该数据,但不会持久到下一页加载。

Both these applications work without issue in the production environment and on other development machines. 这两个应用程序在生产环境和其他开发机器上都可以正常工作。 Same behaviour using Chrome, Firefox & Edge. 使用Chrome,Firefox和Edge的行为相同。

I am honestly stumped as to what the issue could be and could use a little help or even a hint as to where I should be looking. 老实说,我对问题可能是很困惑,可以在我应该去哪里找一点帮助甚至暗示。

Thanks in advance! 提前致谢!

This turned out to be a Codeigniter issue with PHP 7.1. 原来这是PHP 7.1的Codeigniter问题。 It was fixed in a minor version bump a few versions behind the version I was on. 它被修复为一个次要版本,比我使用的版本落后几个版本。 Thanks for everyones suggestions. 感谢大家的建议。 I was using vagrant and for some reason on one of my machines, the vagrant box was installing PHP 5.6 and the other it was installing 7.1, and this is where the session issues were arising. 我正在使用vagrant,并且出于某种原因在我的一台计算机上,vagrant框正在安装PHP 5.6,另一台正在安装7.1,这就是出现会话问题的地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM