Comments (11)
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 [email protected]
on 8 Aug 2013 at 11:49
- Changed title: Set CGI environment variables through parameters passed to executable file
- Changed state: Accepted
from phpdesktop.
[deleted comment]
from phpdesktop.
[deleted comment]
from phpdesktop.
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 [email protected]
on 13 Oct 2013 at 9:42
from phpdesktop.
@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 [email protected]
on 14 Oct 2013 at 7:47
from phpdesktop.
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 [email protected]
on 18 Oct 2013 at 6:30
from phpdesktop.
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 [email protected]
on 22 Jan 2014 at 4:05
from phpdesktop.
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 [email protected]
on 22 Jan 2014 at 10:57
- Changed state: Fixed
from phpdesktop.
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 [email protected]
on 25 Jan 2014 at 3:49
from phpdesktop.
Chrome 31.4 and MSIE 1.12 released.
Original comment by [email protected]
on 26 Jan 2014 at 1:24
from phpdesktop.
Project will move to Github. Find this issue at the new address (soon):
https://github.com/cztomczak/phpdesktop/issues/43
Original comment by [email protected]
on 24 Aug 2015 at 3:20
from phpdesktop.
Related Issues (20)
- Update HOT 4
- Bootstrap 5 off canvas, modals, burgur menu dropdowns is not working in php-desktop for windows. HOT 5
- Any version without chrome HOT 5
- Algum procedimento recomendado para a lib funcionar na versão 7.4 do php?
- Most links on Build/Windows are dead? HOT 2
- slowness HOT 1
- How to upgrade the CEF version? HOT 2
- Unable to play local video HOT 3
- Bootstrap js and Nav Js not work HOT 2
- Compilation : 'OVERRIDE' : unknown substitution specifier HOT 1
- Uncaught (in promise) ReferenceError: AbortController is not defined
- Codeigniter 4 sqlite3 connection problem HOT 3
- Code protection suggestion HOT 7
- Is PHP Desktop compatible with Laravel latest ( versrion 10.x now )?
- Default Window Size But
- how to update the chromium version HOT 6
- how to build this project HOT 3
- Why does php desktop run slow when the machine is connected to internet???
- mp4 format video not working in php desktop HOT 2
- Browser Not Supported HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpdesktop.