CakePHP会话正在写入/ tmp /而不是/ app / tmp / sessions / [英] CakePHP Session being written to /tmp/ and not /app/tmp/sessions/

查看:110
本文介绍了CakePHP会话正在写入/ tmp /而不是/ app / tmp / sessions /的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似的简单但未回答的问题如下:
cakephp session在tmp /会话中没有新文件



我有Cake 2.4.x在本地WAMP服务器上运行。我的phpinfo()显示 c:/ wamp / tmp 的session.save_path。我已经验证了这一点,登录会话当前有会话文件在c:/ wamp / tmp /中创建。



我试图转换为使用蛋糕会话处理。根据 http://book.cakephp.org/2.0/en/development/sessions .html ,使用'cake'会话处理 - 将会话保存为app / tmp /会话中的文件。这是一个不错的选择,当主机不允许你写出自己的家庭目录以外。



所以我把这个代码放在我的核心.php

 配置:: write('Session',array(
'defaults'=&
));问题是我仍然没有看到任何显示在我的应用程序/ tmp / sessions目录下,但是我的应用程序/ tmp /仍然会看到我在c:\wamp\tmp目录中创建的会话文件。



问题:
如何让Cakephp开始写

解决方案

$

重新启动后,通过创建2个cakephp教程博客,并为可怕的会话共享进行并行测试,我意识到以下代码在相应的cakephp安装应用程序/ tmp / sessions文件夹中创建会话文件。

 配置:: write('Session',array(
'defaults'=>'cake'
));

但由于它不适用于我现有的应用程序,我只能得出结论,问题。



查看所有安装程序的phpinfo()也告诉我,cakeblog教程已经成功地覆盖了php.ini中的session.save_path值,我的实际cakephp应用程序本地session.save_path master session.save_path值(从php.ini)的相同值。
这意味着我的core.php设置使用蛋糕会话被覆盖某处!!!!!



经过几个小时的调查,我发现了罪魁祸首。 / p>

我在我的应用程序/ webroot / index.php中有一行代码,我在几个月前插入。

  session_start(); 

这个session_start()我插入基本上是overfactory我的蛋糕core.php设置与原来的php.ini设置。这个session_start()我放在那里最初是克服了一个登录循环错误,我有与IE和Bluehost.com作为主机。我已评论该行和会话文件开始出现在app / tmp / sessions文件夹中。



HALLELUJAH!


Similar simple but unanswered question here: cakephp session no new files in tmp/sessions

I have Cake 2.4.x Running on a local WAMP server. My phpinfo() shows session.save_path of c:/wamp/tmp. I have verified this, login session currently have session files created in c:/wamp/tmp/.

I'm trying to convert to use cake session handling instead. According to http://book.cakephp.org/2.0/en/development/sessions.html , using 'cake' session handling - Saves sessions as files inside app/tmp/sessions. This is a good option when on hosts that don’t allow you to write outside your own home dir.

So i have placed this code inside my Core.php

    Configure::write('Session', array(
        'defaults' => 'cake'
    ));

Problem is I still don't see anything appearing under my app/tmp/sessions directory, but i still see session files being created in my c:\wamp\tmp directory.

Question: How do i get Cakephp to start writing sessions into application directories?

Cheers Kevin

解决方案

After starting afresh by creating 2 cakephp tutorial blogs and testing them side by side for the dreaded session sharing, I realize that the following code worked there in creating session files in the respective cakephp installation app/tmp/sessions folders.

Configure::write('Session', array(
    'defaults' => 'cake'
));

But as it wasn't working for my existing application, I could only conclude that my existing application was the problem.

Looking at phpinfo() on all installations also told me that the cakeblog tutorials were successfully overidding the session.save_path value from php.ini, wher eas my actual cakephp application had the same value for local session.save_path master session.save_path value (from php.ini). Which means that my core.php settings to use cake sessions were being overridden somewhere!!!!!

After hours of investigation i found the culprit.

I had in my app/webroot/index.php a line of code, which i inserted months before.

session_start();

This session_start() i inserted basically was overidding my cake core.php settings with the original php.ini settings. This "session_start()" i had placed in there was initially to overcome a login loop bug which I had with IE and Bluehost.com as the host. I've commented that line and the session files started appearing in the app/tmp/sessions folder.

HALLELUJAH!

这篇关于CakePHP会话正在写入/ tmp /而不是/ app / tmp / sessions /的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆