douxuanou2787 2018-11-06 11:52
浏览 267
已采纳

在session.save_path Codeigniter中使用模式格式

I'm facing a problem using the session library in Codeigniter. On this page it specifically says

To be more specific, it doesn’t support PHP’s directory level and mode formats used in session.save_path, and it has most of the options hard-coded for safety. Instead, only absolute paths are supported for $config['sess_save_path'].

Now what I want is to create session files with permissions 777. I've set the session_save_path in php.ini to 0;0777;/home/sessions/. This is overwritten by the local value by Codeigniter to /home/sessions. How can I force Codeigniter to create these session files with 777 permissions, as it doesn't support this in the config file.

Please don't mind about the 777 permissions on session files.

  • 写回答

2条回答 默认 最新

  • doulouli8686 2018-11-08 14:35
    关注

    About changing the default dir permissions which ic 0700 by default, i don't recommend this at all cause you'll have to change the core system files which is a very bad practice but if you must have a look at Session_files_driver.php and change mkdir($save_path, 0700, TRUE) to mkdir($save_path, 0777, TRUE) if you must and if it doesn't exist already with 0777 permission... btw, i think its way better to use db to store sessions.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?