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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
    • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序