当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Cakephp Session errors after deploying the cms part of my web blog

问题描述:

I have a CakePhp 2.0 blog app installed on netfirms server, the blog is working fine with the PostsController defining terms used by the blog, when I now added actions like edit, add, and delete posts, edited my models with beforeSave() callbacks and added a new controller GalleriesController with the same functionality of deleting images , modifying or adding new ones, then when any cms action takes place whether it is post editing or modification or image editing or modification I receive this errors on the webserver which doesn't show on my local WAMP server installation

Warning (2): session_start(): open(/var/php_sessions/sess_d876a0afa32835689eafbf4a111b60bd, O_RDWR) failed: No such file or directory (2) [CORE/Cake/Model/Datasource/CakeSession.php, line 615]

Warning (2): session_start() [http://php.net/function.session-start]: Cannot send session cookie - headers already sent by (output started at /hermes/bosweb25b/b952/nf.accountname/public_html/lib/Cake/Utility/Debugger.php:776) [CORE/Cake/Model/Datasource/CakeSession.php, line 615]

Warning (2): session_start() [http://php.net/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /hermes/bosweb25b/b952/nf.accountname/public_html/lib/Cake/Utility/Debugger.php:776) [CORE/Cake/Model/Datasource/CakeSession.php, line 615]

Warning (2): Unknown: open(/var/php_sessions/sess_d876a0afa32835689eafbf4a111b60bd, O_RDWR) failed: No such file or directory (2) [Unknown, line 0]

Warning (2): Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/php_sessions) [Unknown, line 0]

网友答案:

When you load your app it tries to create a session file in that location. Obviously it is struggling with that probably due to some permission issues on your server. (Probably your local machine had admin rights so this wasnt an issue)

I find it easier to manage the sessions within the cake app itself.

If you edit core.php. Change the Session configuration entry to look something like the below:

Configure::write('Session', array(
    'defaults' => 'cake',
    'cookie' => 'myapp',
    'timeout' => 4320 //3 days
));

It will store the session files in here: app/tmp/sessions which your app should have access to. Also it will rename your cookie to myapp and set the timeout

You can find more info here: http://book.cakephp.org/2.0/en/development/sessions.html

分享给朋友:
您可能感兴趣的文章:
随机阅读: