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

前端 未结 9 541
半阙折子戏
半阙折子戏 2020-12-18 05:56

I want to store the created sessions in a directory above the root, except when I use any of the following:

    session_save_path($_SERVER[\'DOCUMENT_ROOT\']         


        
9条回答
  •  暖寄归人
    2020-12-18 06:32

    PHP requires session file to be owned by the user running PHP.

    Then just run chown -R www-data:www-data /var/www/storage/sessions/ to own session folder and files by your PHP user (www-data:www-data are your PHP user and group separated by :).

    You can use PHP method get_current_user() or run in bash php -i | grep user and find your user running PHP there.

提交回复
热议问题