PHP session permission problem

前端 未结 4 1631
清歌不尽
清歌不尽 2021-01-18 15:13

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

Warning: session_start() [function.session-start]: open(/tmp/sess_7af3ee9ec1350680bedcf63833

相关标签:
4条回答
  • 2021-01-18 15:28

    It seems like you do not have permissions to write to the tmp directory, you need to give it permissions to save a file.

    0 讨论(0)
  • 2021-01-18 15:28

    I had this problem, as well. There was a line in /etc/sysconfig/httpd that was setting the umask improperly, so I commented it out:

    #umask 644
    

    All is well now.

    0 讨论(0)
  • 2021-01-18 15:31

    I resolve the problem, there was a third party library that sets wrong umask to 777, by deleting it the problem was solved. Thanks for answers.

    0 讨论(0)
  • 2021-01-18 15:33

    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');
    

    edit: next try, umask

    <?php
    echo ' php-umask: ', sprintf('%o', umask()), "\n";
    echo ' exec-umask: ', exec('umask'), "\n";
    
    0 讨论(0)
提交回复
热议问题