php - session_start() 失败 : Permission denied (13)

标签 php unix permissions

好吧,我在尝试允许脚本执行 mkdir() 时成功搞砸了我的权限。这是我的许可当前显示的内容 - 请以某种方式告诉我它们应该是什么才能恢复正常?

XAMPP/:

drwxr-xr-x   8 root      admin      272 Feb 27  2010 XAMPP

drwxr-xr-x   3 username  admin  102 Feb 27  2010 XAMPP Control.app
lrwxr-xr-x   1 username  admin   18 Oct 26  2010 cgi-bin -> xamppfiles/cgi-bin
lrwxr-xr-x   1 username  admin   14 Oct 26  2010 etc -> xamppfiles/etc
lrwxr-xr-x   1 username  admin   17 Oct 26  2010 htdocs -> xamppfiles/htdocs
lrwxr-xr-x   1 username  admin   15 Oct 26  2010 logs -> xamppfiles/logs
drwxr-xr-x  24 root      admin  816 Feb 26 13:30 xamppfiles

xampp文件/:

drwxr-xr-x  258 root  admin   8772 Feb 27  2010 bin
drwxr-xr-x    4 root  admin    136 Feb 27  2010 cgi-bin
drwxr-xr-x    3 root  admin    102 Feb 27  2010 doc
drwxr-xr-x   23 root  admin    782 Feb 27  2010 error
drwxr-xr-x   24 root  admin    816 Feb 27  2010 etc
drwxr-xr-x+  15 root  admin    510 Feb 26 13:59 htdocs
drwxr-xr-x  160 root  admin   5440 Feb 27  2010 icons
drwxr-xr-x  137 root  admin   4658 Feb 27  2010 lib
drwxr-xr-x    2 root  admin     68 Feb 27  2010 libexec
drwxr-xr-x   33 root  admin   1122 Feb 27  2010 licences
drwxr-xr-x    8 root  admin    272 Feb 26 12:00 logs
drwxr-xr-x   75 root  admin   2550 Feb 27  2010 modules
drwxr-xr-x   99 root  admin   3366 Feb 27  2010 phpmyadmin
drwxr-xr-x    8 root  admin    272 Feb 27  2010 sbin
drwxr-xr-x+   2 root  admin     68 Feb 26 13:30 session
drwxr-xr-x   16 root  admin    544 Feb 27  2010 share
drwxr-xr-x   29 root  admin    986 Feb 27  2010 sql-bench
drwxr-xr-x+   4 root  admin    136 Feb 26 12:51 temp
drwxr-xr-x    3 root  admin    102 Feb 27  2010 var
-rwxr-xr-x    1 root  admin  14339 Feb 27  2010 xampp
-rw-r--r--    1 root  admin   6385 Feb 27  2010 xampp.pot

在 htdocs/testsession/中:

drwxr-xr-x+  3 root  admin    102 Feb 26 14:01 testsession

-rw-r--r--@ 1 root  admin  957 Feb 26 14:16 index.php

我的测试 session /index.php:

<?php
// Set the error reporting level
error_reporting(E_ALL);
ini_set("display_errors", 1);
// Start a PHP session
session_start();    
?>

以及错误:

/Applications/XAMPP/xamppfiles/session
Warning: session_start() [function.session-start]: open(/Applications/XAMPP/xamppfiles/temp//sess_1b9827985300349847f0169f1031b113, O_RDWR) failed: Permission denied (13) in /Applications/XAMPP/xamppfiles/htdocs/testsession/index.php on line 10

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/testsession/index.php:7) in /Applications/XAMPP/xamppfiles/htdocs/testsession/index.php on line 10

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /Applications/XAMPP/xamppfiles/htdocs/testsession/index.php:7) in /Applications/XAMPP/xamppfiles/htdocs/testsession/index.php on line 10

Warning: Unknown: open(/Applications/XAMPP/xamppfiles/temp//sess_1b9827985300349847f0169f1031b113, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/Applications/XAMPP/xamppfiles/temp/) in Unknown on line 0

最佳答案

chmod -R o+w ...../temp 甚至更好(更安全)chown -R apache.apache......./temp >(将 apache 替换为您的网络服务器正在使用的用户/组名)。

关于php - session_start() 失败 : Permission denied (13),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9456384/

相关文章:

php - 无法将 ID 插入 MySQL 表

php - Null 有课吗?

shell - 如何检查文件是否是二进制文件并读取所有不是的文件?

linux - 创建 .deb 文件时出现权限问题

python - 为什么即使没有执行/'x' 权限也可以运行 python 脚本?

php - 执行准备好的语句但插入值时引发 PDO 异常

php - Mysqli->fetch_row问题

c - 为什么 ENOENT 表示 "No such file or directory"?

perl - 如何使用 Perl 库函数将 UID 映射到用户名?

python - 如何编写一个git hook来限制写入分支?