<bdo id='PjdTD'></bdo><ul id='PjdTD'></ul>

<small id='PjdTD'></small><noframes id='PjdTD'>

    1. <tfoot id='PjdTD'></tfoot>
      <i id='PjdTD'><tr id='PjdTD'><dt id='PjdTD'><q id='PjdTD'><span id='PjdTD'><b id='PjdTD'><form id='PjdTD'><ins id='PjdTD'></ins><ul id='PjdTD'></ul><sub id='PjdTD'></sub></form><legend id='PjdTD'></legend><bdo id='PjdTD'><pre id='PjdTD'><center id='PjdTD'></center></pre></bdo></b><th id='PjdTD'></th></span></q></dt></tr></i><div id='PjdTD'><tfoot id='PjdTD'></tfoot><dl id='PjdTD'><fieldset id='PjdTD'></fieldset></dl></div>

      <legend id='PjdTD'><style id='PjdTD'><dir id='PjdTD'><q id='PjdTD'></q></dir></style></legend>

        PHP 会话未保存在内存缓存中

        PHP sessions not being saved in memcache(PHP 会话未保存在内存缓存中)

            <tbody id='mGmKC'></tbody>
          <tfoot id='mGmKC'></tfoot>
        1. <i id='mGmKC'><tr id='mGmKC'><dt id='mGmKC'><q id='mGmKC'><span id='mGmKC'><b id='mGmKC'><form id='mGmKC'><ins id='mGmKC'></ins><ul id='mGmKC'></ul><sub id='mGmKC'></sub></form><legend id='mGmKC'></legend><bdo id='mGmKC'><pre id='mGmKC'><center id='mGmKC'></center></pre></bdo></b><th id='mGmKC'></th></span></q></dt></tr></i><div id='mGmKC'><tfoot id='mGmKC'></tfoot><dl id='mGmKC'><fieldset id='mGmKC'></fieldset></dl></div>
            <bdo id='mGmKC'></bdo><ul id='mGmKC'></ul>
            <legend id='mGmKC'><style id='mGmKC'><dir id='mGmKC'><q id='mGmKC'></q></dir></style></legend>

            1. <small id='mGmKC'></small><noframes id='mGmKC'>

                  本文介绍了PHP 会话未保存在内存缓存中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  使用 Amazon Linux 在 AWS 上使用 php 5.4 运行应用程序.

                  Running an application using php 5.4 on AWS using the Amazon Linux.

                  PHP 版本为 PHP 5.4.28.从 AWS 存储库安装的 memcache 库是 php54-pecl-memcache-3.0.8-1.11.amzn1.x86_64

                  PHP version is PHP 5.4.28. memcache lib installed from the AWS repo is php54-pecl-memcache-3.0.8-1.11.amzn1.x86_64

                  我已经验证 php 正在使用/etc/php.ini:

                  I have verified that php is using /etc/php.ini:

                  [root@ip-xx.xx.xx.xx]# php -i | grep Config
                  Configuration File (php.ini) Path => /etc
                  Loaded Configuration File => /etc/php.ini
                  

                  设置显示我应该使用内存缓存:

                  The setting show that I should be using memcache:

                  [root@ip-10-40-17-119 etc]# grep "^session.save" php.ini
                  session.save_handler="memcache"
                  session.save_path="tcp://<elasticache-endpoint>:11211"
                  
                  [root@ip-10-40-17-119 php.d]# php -i | grep session.save
                  session.save_handler => memcache => memcache
                  session.save_path => tcp://<elasicache-endpoint>:11211?persistent=1&weight=1&timeout=1&retry_interval=15 => tcp://<elasticache-endpoint>:11211?persistent=1&weight=1&timeout=1&retry_interval=15
                  

                  我可以从盒子telnet到终点&端口并正确连接,因此实例能够连接到 memcached 服务器.

                  I can telnet from the box to the end point & port and connect properly, so the instance is able to connect to the memcached server.

                  我们尝试过的事情:

                  • 我已经从 php.ini 文件中删除了 tcp://,这并没有什么不同 - 会话仍然保存在文件中.
                  • 我们已从 session.save_handler="memcache" 更改为 session.save_handler="memcached"
                  • 每次我们进行更改时,我们都会停止 httpd 服务器,然后重新启动它
                  • 我们甚至尝试过重启服务器

                  无论我们尝试过什么,会话都存储在磁盘上的/var/lib/php/sessions 中.是我遗漏了什么,还是这是已知的 5.4 或 AWS 问题?

                  Regardless of what we've tried, sessions are stored on disk to /var/lib/php/sessions. Is there something I'm missing, or is this a known 5.4 or AWS issue?

                  推荐答案

                  好的,我们设法解决了问题.

                  OK, we managed to figure out the issue.

                  首先,我们创建了一个输出 phpinfo() 的简单页面.请注意,通过 Web 服务器运行它很重要 - 运行 php -i 不包括 apache 可能添加的任何覆盖.

                  First, we created a simple page that spit out phpinfo(). Note that it is important that you run this thru the web server - running php -i DOES NOT include any overrides that apache may add.

                  在会话部分下,输出列出了所有指令,以及本地值"和主值".

                  Under the session section, the output lists all the directives, and a "Local Value" and a "Master Value".

                  本地值有:

                  session.save_handler    files
                  session.save_path   /var/lib/php/session
                  

                  虽然主价值观有:

                  session.save_handler    memcache
                  session.save_path   tcp://<endpoint>:11211
                  

                  事实证明,在/etc/httpd/conf.d/php.conf 中默认安装了一个覆盖来指定文件.这似乎是 Redhat/CentOS/Fedora 的事情.

                  It turns out that there's an override installed by default in /etc/httpd/conf.d/php.conf that specifies the files. This appears to be a Redhat/CentOS/Fedora thing.

                  从 php.conf 中删除这些值修复了问题.

                  Removing those values from php.conf fixed the problem.

                  这篇关于PHP 会话未保存在内存缓存中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                      • <bdo id='VWANN'></bdo><ul id='VWANN'></ul>
                        1. <small id='VWANN'></small><noframes id='VWANN'>

                            <tbody id='VWANN'></tbody>

                          • <i id='VWANN'><tr id='VWANN'><dt id='VWANN'><q id='VWANN'><span id='VWANN'><b id='VWANN'><form id='VWANN'><ins id='VWANN'></ins><ul id='VWANN'></ul><sub id='VWANN'></sub></form><legend id='VWANN'></legend><bdo id='VWANN'><pre id='VWANN'><center id='VWANN'></center></pre></bdo></b><th id='VWANN'></th></span></q></dt></tr></i><div id='VWANN'><tfoot id='VWANN'></tfoot><dl id='VWANN'><fieldset id='VWANN'></fieldset></dl></div>
                            <legend id='VWANN'><style id='VWANN'><dir id='VWANN'><q id='VWANN'></q></dir></style></legend>
                          • <tfoot id='VWANN'></tfoot>