PHP Warning Permission denied (13) on session_star

2019-01-07 13:05发布

Possible Duplicate:
How can I fix the Permission error when I call session_start()?

I'm getting the following error:

PHP Warning:  session_start() [<a href='function.session-start'>function.session-start</a>]: open(/tmp/sess_49a20cbe1ef09a2d0262b3f7eb842e7b, O_RDWR) failed: Permission denied (13) in /home/------/public_html/includes/libs/ss.inc.php on line 1

The problem doesn't happen all the time, but comes and goes.

This the code at line on 1 in ss.inc.php

<?php session_start(); ?>

5条回答
贪生不怕死
2楼-- · 2019-01-07 13:26

PHP does not have permissions to write on /tmp directory. You need to use chmod command to open /tmp permissions.

查看更多
看我几分像从前
3楼-- · 2019-01-07 13:38

I have had this issue before, you need more than the standard 755 or 644 permission to store the $_SESSION information. You need to be able to write to that file as that is how it remembers.

查看更多
再贱就再见
4楼-- · 2019-01-07 13:38

It seems that you don't have WRITE permission on /tmp.

Edit the configuration variable session.save_path with the function session_save_path() to 1 directory above public_html (so external users wouldn't access the info).

查看更多
Summer. ? 凉城
5楼-- · 2019-01-07 13:43

You don't appear to have write permission to the /tmp directory on your server. This is a bit weird, but you can work around it. Before the call to session_start() put in a call to session_save_path() and give it the name of a directory writable by the server. Details are here.

查看更多
6楼-- · 2019-01-07 13:47

do a phpinfo(), and look for session.save_path. the directory there needs to have the correct permissions for the user and/or group that your webserver runs as

查看更多
登录 后发表回答