duanjian4331 2019-08-06 09:16
浏览 526

PHP5.6 session_start无法写入tmp文件夹(php.ini设置不起作用,ini_set at top)

I've got an odd issue with sessions in my app. The app is running within docker containers. In essence everything within the Dockerfile's and entrypoint-php.sh files sets things up fine. The php.ini settings for sessions is as follows:

session.save_path = /tmp
session.use_strict_mode = 1
session.name = K2CLOCATION
session.auto_start = 0
session.cache_expire = 240
session.hash_function = sha256

but when I hit the index.php file I get the warning

Warning: session_start(): open(/tmp/php/session/1/b/f/sess_1bf0f6fcf5413365a2e5540be2f40b58f0f21b5c16d2214257a5303650649715, O_RDWR) failed: No such file or directory (2) in /var/www/k2c/v03/agent_v07/index.php on line 3

If I then edit the index.php file at the top and add ini_set('session.save_path', '/tmp'); above session_start(); everything works and I can see the sessions been written.

The /tmp/php/session folder has 777 permissions. It was originally owned by root and I attempted to change this to the PHP user (nobody:nobody) but this also had no effect.

Other things I have tried:

I tried moving the sessions folder to somewhere completely removed from the system tmp folder and this resulted in no change.

Drive space is only 9% used.

System info:

PHP5.6

Running dockerized Centos with Nginx

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 永磁型步进电机PID算法
    • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
    • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
    • ¥200 uniapp长期运行卡死问题解决
    • ¥15 latex怎么处理论文引理引用参考文献
    • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
    • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?