Closed GoogleCodeExporter closed 9 years ago
Related topic on the PHP Desktop Forum:
"Interaction between PhpDesktop and .exe (throwing param)"
https://groups.google.com/d/topic/phpdesktop/nNLWpjofqvY/discussion
Original comment by czarek.t...@gmail.com
on 8 Aug 2013 at 11:49
[deleted comment]
[deleted comment]
It might take me about three weeks to find some spare time, but if no one is on
this particular issue I can take it.
Original comment by ga...@approachfoundation.org
on 13 Oct 2013 at 9:42
@approachfoundation.org : It might be a good solution if you can take it.
The solution we have choose is to write some parameters in the php.ini file.
But it's not the right way cause the process need to be re-start again when you
want to use a variable.
So the problem is still alive
Original comment by josselin...@gmail.com
on 14 Oct 2013 at 7:47
Referring to http://cesanta.com/docs.html#docs/Options.md I thought this should
work out. I haven't test this yet aside from grabbing the arguments, as I still
haven't had much time, but thought I'd post this anyway. If it works for
anyone, you might want to use the concept but get the value of lpstrCmdLine
into StartWebServer through another context instead of by passing, or maybe
just use an overload.
Basically I just turn WinMain's lpstrCmdLine into an array, similar to argv in
standard main or wmain, and place them in the string format Mongoose prefers.
Ideally, you can find a better function than explode to parse CLI arguments,
this one will not allow spaces in options but should do OK.
This is just a quick run through but it could be used to work up a proper
version pretty quickly.
-Garet
Line #230 main.cpp:
if (!StartWebServer(lpstrCmdLine)) {
Line #38 web_server.cpp
bool StartWebServer(&LPTSTR WinArgsCLI) {}
Lines #105-#116 web_server.cpp
const char* options[] = {
"document_root", wwwDirectory.c_str(),
"listening_ports", listening_ports.c_str(),
"index_files", indexFiles.c_str(),
"cgi_interpreter", cgiInterpreter.c_str(),
"cgi_pattern", cgiPattern.c_str(),
"cgi_environment", WinToMongooseArgsCLI(WinArgsCLI),
NULL
};
mg_callbacks callbacks = {0};
callbacks.log_message = &log_message;
callbacks.end_request = &end_request;
g_mongooseContext = mg_start(&callbacks, NULL, options);
.
.
.
Added functions for web_server.php:
string WinToMongooseArgsCLI(LPTSTR lpstrCmdLine)
{
string MongooseArgsCLI = "";
vector<string> WinArgsCLI=explode( lpstrCmdLine," ");
for(unsigned int i=1,L=WorkWith.size();i<L;i+=2 ){ Mongoose_CLI_KeyValueList = Mongoose_CLI_KeyValueList + WorkWith[i-1] +"="+ WorkWith[i] + ((i>=L-2)?"":","); }
return MongooseArgsCLI;
}
vector<string> explode (const string &str, const string &delimiter)
{
vector<string> arr;
int strleng = str.length();
int delleng = delimiter.length();
if (delleng==0)
return arr;//no change
int i=0;
int k=0;
while( i<strleng ){
int j=0;
while (i+j<strleng && j<delleng && str[i+j]==delimiter[j])
j++;
if (j==delleng){ //found delimiter
arr.push_back( str.substr(k, i-k) );
i+=delleng;
k=i;
}
else{
i++;
}
}
arr.push_back( str.substr(k, i-k) );
return arr;
}
Original comment by ga...@approachfoundation.org
on 18 Oct 2013 at 6:30
I have successfully set the "cgi_environment" option in Mongoose to set the
TMP, TEMP and TEMPDIR environment variables. See revision 89f4820f0bf1.
Original comment by czarek.t...@gmail.com
on 22 Jan 2014 at 4:05
CGI environment variables can now be passed to the phpdesktop executables.
See revision 07c81718f5a5.
See the CGIEnvironmentFromArgs wiki page:
https://code.google.com/p/phpdesktop/wiki/CGIEnvironmentFromArgs
Original comment by czarek.t...@gmail.com
on 22 Jan 2014 at 10:57
Revision 8091beb8d108 fixes problems with port conflicts. A random port is now
assigned when port is set to 0. The CGI environment variables did not work when
both instances of application where listening on the same port. Now with random
port support this issue is solved.
Original comment by czarek.t...@gmail.com
on 25 Jan 2014 at 3:49
Chrome 31.4 and MSIE 1.12 released.
Original comment by czarek.t...@gmail.com
on 26 Jan 2014 at 1:24
Project will move to Github. Find this issue at the new address (soon):
https://github.com/cztomczak/phpdesktop/issues/43
Original comment by czarek.t...@gmail.com
on 24 Aug 2015 at 3:20
Original issue reported on code.google.com by
j...@ru5.fr
on 8 Aug 2013 at 11:25