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 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
    • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
    • ¥200 uniapp长期运行卡死问题解决
    • ¥15 latex怎么处理论文引理引用参考文献
    • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
    • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
    • ¥15 乘性高斯噪声在深度学习网络中的应用