PHP会话不支持Amazon EC2

时间:2022-09-19 14:42:07

I am currently working on a Facebook application that runs on Amazon EC2. The app is working and most development is complete, however we cannot get sessions to persist. We have tried PHP default session handling, database handling and memcache handling using the PHP session save_path trick. We've tried messing with ini settings like auto_start, no avail.

我目前正在开发一个在Amazon EC2上运行的Facebook应用程序。该应用程序正在运行,大多数开发已经完成,但是我们不能让会话继续。我们使用PHP会话save_path技巧尝试了PHP默认会话处理、数据库处理和memcache处理。我们尝试过像auto_start这样的ini设置,但没有效果。

The weird problem is that the initial session write DOES write, but any subsequent write after the first does not save. We can see the session cookie persisting, but the actual writing of data always fails after the first write. This weird problem applies to any session handler we use.

奇怪的问题是,初始会话写入确实会写入,但是第一个之后的任何后续写入都不会保存。我们可以看到会话cookie持久化,但是数据的实际写入总是在第一次写入之后失败。这个奇怪的问题适用于我们使用的任何会话处理程序。

Our EC2 setup is as follows:

我们的EC2设置如下:

  • Dev: 1 64bit linux server, 1 mongodb server, 1 elasticache cluster
  • 开发:1个64位linux服务器,1个mongodb服务器,1个弹带集群
  • Staging: 1 64bit linux server, 1 mongodb server, 1 elasticache cluster
  • 舞台:1个64位的linux服务器,1个mongodb服务器,1个弹性集群。
  • Prod: 2 64bit linux servers with 1 load balancer, 3 mongodb servers with replicaset, 2 elastic ache clusters
  • Prod: 2个64位linux服务器和1个负载均衡器,3个mongodb服务器和replicaset, 2个弹性ache集群

The session problem is reproducable in all environments. I am running out of ideas here as I have tried everything I know and anything I found while Googling.

会话问题在所有环境中都是可繁殖的。我在这里已经没有什么想法了,因为我已经尝试了所有我知道的和我在谷歌上找到的东西。

For reference we are using CakePHP 2.1, but have also tried sessions outside of CakePHP.

作为参考,我们使用CakePHP 2.1,但也尝试过CakePHP之外的会话。

1 个解决方案

#1


0  

Check the session.save_path in your php.ini.

检查会话。save_path php . ini。

Read this too: http://php.net/manual/en/function.session-save-path.php

读这篇文章:http://php.net/manual/en/function.session-save-path.php

Also, you may want to post all the session.* parts of your php.ini.

此外,您可能希望发布所有会话。*你的php.ini部分。

#1


0  

Check the session.save_path in your php.ini.

检查会话。save_path php . ini。

Read this too: http://php.net/manual/en/function.session-save-path.php

读这篇文章:http://php.net/manual/en/function.session-save-path.php

Also, you may want to post all the session.* parts of your php.ini.

此外,您可能希望发布所有会话。*你的php.ini部分。