Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid temp directory on Windows 8 - permission denied to write a session file or to upload a file #23

Closed
GoogleCodeExporter opened this issue Aug 28, 2015 · 14 comments

Comments

@GoogleCodeExporter
Copy link

it wants to write to C:\Windows


Original issue reported on code.google.com by ykoro...@gmail.com on 5 Mar 2013 at 6:55

@GoogleCodeExporter
Copy link
Author

This is not enough for a bug report, I have no idea of what you're
trying to say.

Original comment by czarek.t...@gmail.com on 5 Mar 2013 at 6:57

  • Changed state: Invalid

@GoogleCodeExporter
Copy link
Author

When using Windows 8, I get this problem as well. It seems that the session 
files gets written to c:\Windows - but phpdesktop doesn't have the right 
permissions. This is the error I get when running phpLiteAdmin:

Warning: session_start(): open(C:\Windows\sess_*******, O_RDWR) failed: 
Permission denied (13) ...

Original comment by i...@taapo.com on 18 Jun 2013 at 9:19

@GoogleCodeExporter
Copy link
Author

What is the tmp directory showed in phpinfo()?

Have you tried setting the session save path?

    ini_set('session.save_path', 'C:/Windows/temp');

Try "C:/Windows/temp" or some other directory that your application 
has permission to write to.

Anyone having problems with writing session files will probably also
have problem uploading files, if so try setting the "upload_tmp_dir" 
option using ini_set() similarly to the "session.save_path" option.

Original comment by czarek.t...@gmail.com on 18 Jun 2013 at 9:44

  • Changed title: Permission denied to write session file (or upload a file)
  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Since PHP 5.5.0 there is an another php.ini option besides the
"session.save_path" and "upload_tmp_dir" that might interest us,
it's named "sys_temp_dir", but this one can be set only through
php.ini, it cannot be changed with ini_set().

Original comment by czarek.t...@gmail.com on 18 Jun 2013 at 9:52

@GoogleCodeExporter
Copy link
Author

In phpinfo() the save_path is set to "no value".

Can we set values in php.ini itself? Because doing ini_set for several 
third-party scripts would be a pain.

Original comment by i...@taapo.com on 19 Jun 2013 at 7:33

@GoogleCodeExporter
Copy link
Author

Adding this to php.ini seems to help indeed:

session.save_path = C:/Windows/temp

Original comment by i...@taapo.com on 19 Jun 2013 at 7:35

@GoogleCodeExporter
Copy link
Author

Yes, these are php.ini options, you can set them by editing the php.ini
file or set it dynamically via ini_set(), the advantage of the second
method is that you can check if the "C:/Windows/temp" really exists, as
user may be running Windows from another partition for exmaple D:/ and
hardcoding the path might fail in this case. There is an 
"auto_prepend_file" directive that you could use with third-party 
scripts to set the temp directory dynamically using ini_set():

http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file

Original comment by czarek.t...@gmail.com on 19 Jun 2013 at 7:42

@GoogleCodeExporter
Copy link
Author

TODO: Create an example in the www/ directory for using sessions and
uploading files, it should handle cases when the TMP/TEMP environment
variable is not set in Windows, thus the "session.save_path" or the
"upload_tmp_dir" options are empty in phpinfo().

Original comment by czarek.t...@gmail.com on 19 Jun 2013 at 7:47

@GoogleCodeExporter
Copy link
Author

Original comment by czarek.t...@gmail.com on 4 Jul 2013 at 5:58

  • Changed title: Invalid temp directory on Windows 8 - permission denied to write a session file or to upload a file

@GoogleCodeExporter
Copy link
Author

A php example script will be added to the php desktop binaries with an
exaplanation that PHP temp environment variables should be set on this OS.

Original comment by czarek.t...@gmail.com on 21 Jul 2013 at 6:38

  • Added labels: NextRelease

@GoogleCodeExporter
Copy link
Author

Original comment by czarek.t...@gmail.com on 19 Jan 2014 at 11:40

  • Changed state: Duplicate

@GoogleCodeExporter
Copy link
Author

I have investigated the issue again and the problem was that the TMP 
environment variable was not set by the Mongoose webserver. Fixed in revision 
89f4820f0bf1. Added the upload and session examples.

Original comment by czarek.t...@gmail.com on 22 Jan 2014 at 4:07

@GoogleCodeExporter
Copy link
Author

Project will move to Github. Find this issue at the new address (soon): 
https://github.com/cztomczak/phpdesktop/issues/23

Original comment by czarek.t...@gmail.com on 24 Aug 2015 at 3:17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant