PHP会话权限问题 [英] PHP session permission problem

查看:81
本文介绍了PHP会话权限问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试初始化会话,但出现此错误:

I'm trying to initialize a session but i get this error:

警告:session_start()[function.session-start]:open(/tmp/sess_7af3ee9ec1350680bedcf63833d160bd,O_RDWR)失败:权限被拒绝(13)

Warning: session_start() [function.session-start]: open(/tmp/sess_7af3ee9ec1350680bedcf63833d160bd, O_RDWR) failed: Permission denied (13)

session.path设置为/tmp,具有777个权限.

The session.path is set to /tmp with 777 perms.

我尝试将session.path编辑为"0; 777;/tmp",但是创建的会话文件具有错误的权限(只能写).

I try to edit the session.path to "0;777;/tmp" but the session files are created with the wrong permissions(only write).

我在apache2和ubuntu 9.10上使用PHP 5.2. 有什么想法吗?

I'm using PHP 5.2 on apache2 and ubuntu 9.10. Any ideas?

推荐答案

请验证/tmp的权限确实是xx777

Please verify that the permissions of /tmp really are xx777

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$s = stat('/tmp');
printf('%o', $s[2]);
file_put_contents('/tmp/phptest1234.txt', 'test');
unlink('/tmp/phptest1234.txt');

下次尝试, umask

<?php
echo ' php-umask: ', sprintf('%o', umask()), "\n";
echo ' exec-umask: ', exec('umask'), "\n";

这篇关于PHP会话权限问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆