duanpu1064 2018-10-22 10:51
浏览 45

PHP Session和Cookies无法在本地MAMP环境中运行

I’m trying to set up a local MAMP PHP development environment to develop a PHP web application for deployment on an Apache web server. The web app spans several subdomains, with one subdomain, “portal.” handling user accounts, logins, etc.

The user portal uses PHP Session variables, as well as cookies, to mark a user as logged in, and several of the subsequent methods rely on the user’s logged in status (checked using the session variable and cookies).

The problem is that the cookies and Session variables set on the Portal subdomain don’t seem to be shared across the whole site. Everything works fine on the web server, but on my MAMP environment the cookies and Session variables appear unset outside of the subdomain where they are initially set. This is not the case on the web server, where the cookies and Session variables appear to be shared across the entire site.

I’ve tried this using both localhost and a local development domain (e.g. “portal.domain.test”) set up through my hosts file. I’m using Apache vhosts for subdomains the same as I am on the web server.

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 安装svn网络有问题怎么办
    • ¥15 Python爬取指定微博话题下的内容,保存为txt
    • ¥15 vue2登录调用后端接口如何实现
    • ¥65 永磁型步进电机PID算法
    • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
    • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
    • ¥15 latex怎么处理论文引理引用参考文献