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)
- Chrome 33 release (CEF branch 1750) HOT 2
- Change mouse cursor indicator during loading of a web page in Chrome 33 and later branches HOT 1
- Help - Add settings disabled_maximinize_button in popup
- Option in settings.json to use newer IE version embedded HOT 1
- PHP Desktop X Chrome - an implementation of phpdesktop for Mac/Linux using Python and CEF Python HOT 6
- I am using html2pdf for pdf load... After pdf file print redirect anothe php page...
- I am using html2pdf for pdf load... After pdf file print redirect anothe php page...
- I am using html2pdf for pdf load... After pdf file print redirect anothe php page... My code works in browser... But not work in phpdesktop IE..
- I am using html2pdf for pdf load... After pdf file print redirect anothe php page... My code works in browser... But not work in phpdesktop IE.. Plz solve that problem
- Compiling using Mingw
- html2pdf not support
- phpdesktop application very slow
- Ie not support designing and add registry code also useless
- convert a html to pdf using html2pdf generation is not working in chrome browser
- Pdf not work in chrome...
- pdf file not support in chrome
- A way to launch external processes/servers during startup or later, and automatic shutdown of these processes when app exits HOT 2
- Certificates
- Allow to listen on all ip addresses available HOT 1
- 1>main.cpp(180): error C2440: 'initializing' : cannot convert from 'const _json_value' to 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
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.