1

I am trying to transition my local PHP development from a Windows XAMPP stack to using the Windows Subsystem for Linux. Under WSL my website codebase is located on the windows filesystem and is accessible to the Apache webserver via /mnt/c/www/myweb.

I have inherited a codebase that sets session.save_path to the root of the website ie. /mnt/c/www/myweb and then runs session_start(). This worked fine under XAMPP but under WSL the session start command fails with a fatal exception and the error message "Warning: session_start(): Session data file is not created by your uid".

From the WSL command line I can create a file at /mnt/c/www/myweb and also appear to be able to run chmod commands.

Is this a limitation of the interface between WSL and the Windows filesystem or am I doing something else wrong?

elb
  • 167
  • 1
  • 8
  • Possible duplicate of https://stackoverflow.com/questions/41771425/session-start-session-data-file-is-not-created-by-your-uid – 04FS Jun 25 '19 at 12:30
  • Although, storing session data in the website root does not sound like a good idea to begin with. I’d try and set that to a directory outside the document root, or if that is not possible, then at least to a dedicated directory inside, that explicitly does not allow HTTP access to any of the contents. – 04FS Jun 25 '19 at 12:31
  • @04FS I agree. The code is meant to store the session files in a tmp directory within the doc root, but there is a code error in forming the path that means they end up in the root. My issue is that the session_start() command fails wherever the save_path is set to if it is accessed via the /mnt/c mount point WSL sets up. – elb Jun 25 '19 at 16:29

0 Answers0