dpzbzp8728 2018-12-10 18:05
浏览 293

PHP会话数据文件不是由您的uid(Vagrant CentOS)创建的

I try to do the following:

ini_set('session.save_path', '/var/www/example/sessions');

session_start();

but I get the following error:

session_start(): Session data file is not created by your uid

I check get_current_user() in returns vagrant

I check permission of /var/www/example/sessions it returns:

drwxrwxrwx 1 vagrant vagrant 4.0K Dec 11 01:58 sessions


Note: the answer stated here does not work for me because doing:

chown -R www-data:www-data /var/www/example/sessions/ returns an error:

chown: invalid user: ‘www-data:www-data’.

In Vagrant, it appears vagrant is the PHP user.


Note: The session files appears to get created inside the custom session folder but they are empty. e.g., sess_k92fdn46onm5an0mau6p50tr2g doesn't contain anything.

Any ideas?

  • 写回答

1条回答 默认 最新

  • dow58115 2018-12-10 23:27
    关注

    You are correct, your user is vagrant. Have you tried running sudo chown -R www-data:vagrant /var/www/example/sessions/? You are getting the error because www-data is not a user. Hope this helps.

    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘