wcbzero / phpdesktop

Automatically exported from code.google.com/p/phpdesktop
0 stars 0 forks source link

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

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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 commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
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 commented 9 years ago
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 commented 9 years ago
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 commented 9 years ago
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 commented 9 years ago
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 commented 9 years ago

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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago

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

GoogleCodeExporter commented 9 years ago
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