Thank you! Pushed https://github.com/cesanta/mongoose/commit/652c352394b89948aae3dc8335e304a8034a0412 I am using getenv(), thus not sure how it'll behave on Windows if path contains non-ascii characters.
On Sun, Feb 2, 2014 at 5:54 PM, Czarek Tomczak <[email protected]>wrote: > Hi Sergey, > > Mongoose doesn't set the temporary directory environment variables and > when running php scripts on Win7 and Win8 the temp directory is being set > to "C:\Windows". This results in errors as user doesn't have write > permission to that directory due to UAC security features. Mongoose should > set the TMP or TEMP environment variable to fix it (in my case I've set all > three just to be sure: TMP, TEMP and TMPDIR). On windows you can use the > GetTempPath()<http://msdn.microsoft.com/en-us/library/windows/desktop/aa364992(v=vs.85).aspx>function. > This will return a string like > "C:\Users\%USER%\AppData\Local\Temp\". > > Unfortunately if user's name contains unicode characters then this won't > work with PHP, as php doesn't support unicode. The solution might be to set > the temp directory to "C:\Windows\Temp" with the help of the > GetWindowsDirectory()<http://msdn.microsoft.com/en-us/library/windows/desktop/ms724454(v=vs.85).aspx>function. > Not sure what would be a better solution, to set C:\Windows\Temp > by default, or to detect whether the path returned by GetTempPath() > contains unicode characters and only then do the fallback. The > GetTempPath() may also return a short path string like > "C:\DOCUME~1\UNICOD~1\LOCALS~1\Temp" on Windows XP when user's name > contains unicode characters. And PHP also doesn't like such paths, some > things like sessions will work fine with such a temp dir, but others like > uploading of files will not work. > > Not sure if the entire PHP unicode issue is to be fixed in Mongoose. But > as you provide PHP bundle it might be worth to consider. > > The other problem I noticed is the SERVER_NAME environment variable. It is > by default set to "mydomain.com" by Mongoose. I don't think this is the > default behavior of other web servers. When there is no domain provided > then it should be set to SERVER_ADDRESS. So if it's listening on 127.0.0.1, > then that should be the SERVER_NAME as well. Many php scripts out there may > use this env variable (I know I was) and "mydomain.com" would probably > break apps. > > Best regards, > Czarek > > -- > You received this message because you are subscribed to the Google Groups > "mongoose-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/mongoose-users. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "mongoose-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mongoose-users. For more options, visit https://groups.google.com/groups/opt_out.
