2

Warning: session_start(): Failed to read session data: user (path: /tmp)

Warning: session_start(): Failed to read session data: user (path: /tmp)

After lots of Googling and cursing found out The above error can be thrown on various reasons: Folder permissions -> Given Folder unavailability -> Folder there

But i have checked all above not these reasons. Iam using db sessions . Can anyone help me to solve this issue .

  • 2 thoughts. 1: It has to be a permission issue if the folder exists. Try creating a different folder and set it writable (writable by the user that the web server runs under). 2: Also... are you sure it is not because the browser is re-using an old session? Am not sure what happens if same session is used with newer PHP version. To test this, try clearing all cookies from the browser or use a browser profile that doesn't have any cookies set for your server. – AVRajan Jan 19 '23 at 07:06
  • _"Iam using db sessions"_ - not sure why it should try to read anything from the file system then in the first place. Can you elaborate a bit more, what exactly "db sessions" means in your case? Custom implementation, or ...? – CBroe Jan 19 '23 at 07:13
  • DB sessions means sessions saved in data base table . https://www.php.net/manual/en/function.session-set-save-handler.php – Pranay Reddy Jan 19 '23 at 09:13
  • @AVRajan no not those reasons already tried – Pranay Reddy Jan 19 '23 at 09:13
  • Well... is the browser sending the cookies in the header or not? If not, then cookies are not set for the session. Are you using cookies for the session? – AVRajan Jan 19 '23 at 14:14

1 Answers1

1

Solution i Have Got

I have got the solution issue is due to when reading session it is returning null by adding this code solved. Thanks!

  • You should avoid posting screen shots like that. You can paste details in as text and link to more detailed documentation if needed. – Taras Jan 21 '23 at 11:31
  • Thank you this helped me to find out what was the issue. – Rao DYC Mar 25 '23 at 15:21