Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start as a Windows Service before/without Logon #223

Open
QTMcKay opened this issue Jan 21, 2018 · 6 comments
Open

Start as a Windows Service before/without Logon #223

QTMcKay opened this issue Jan 21, 2018 · 6 comments

Comments

@QTMcKay
Copy link

QTMcKay commented Jan 21, 2018

The idea would be that the Mongoose Webserver could be set to run as a Service so that no Login is required, like any Webserver can do (according to Mongoose docs, running it as a Service is already possible).
The Service could supply an Icon in the Tray as soon as a User logs in, which upon clicking the icon, the Chrome (or IE) GUI is invoked.

Here is an excellent article with source code showing a small Service Application that subsequently launches a program when User Login occurs...

https://www.codeproject.com/Articles/35773/Subverting-Vista-UAC-in-Both-32-and-64-bit-Archite

Forum reference:
https://groups.google.com/forum/#!topic/phpdesktop/vMAvdg8byW0

@cztomczak
Copy link
Owner

What is the purpose of starting web server before/without logon? How would that be useful to phpdesktop users in general? It seems that such feature solves your specific problem that you haven't described. Before such feature can be merged you have to explain why is this useful. Pull requests are welcome.

@cztomczak
Copy link
Owner

Same question for starting as window service. How is that useful to phpdesktop users and what is the advantage of starting as service over adding application to Startup Programs? (along with implementing starting app minimized feature)

@QTMcKay
Copy link
Author

QTMcKay commented Jan 23, 2018

I have a JS App that runs on Client Devices and communicates via AJAX using JSON messages/responses with a PHP Desktop "server". The Server, written in PHP, supplies the JS code for the Clients, and it has access to the filesystem, and more importantly a Database (MSSQL) that it interacts with to formulate JSON-encoded responses. The Server also hosts a GraphQL Service which facilitates several other queries and mutations that the Clients can use.

Because of the Browser in PHP Desktop, we can use that feature to set particular configuration parameters for the Server, such as local paths, DB Credentials, Key Management Services, etc. Once this is done, the Server Browser "interface" is rarely needed. But the Webservice still needs to be running to serve Clients.

If the Mongoose Webserver could run as a Service (without Logon), then the Server could now become "headless" and never need to be touched.

If something needed to be changed in the Application Configuration, then a user could Login, make changes through the Browser "interface" and Log Out, but the Webserver would remain running. After all, that's what Webservers do - run as a Service in background (without Login), and continue to run, even after Log Out.

I could use IIS or Apache or some other Webserver Service and a separate Browser on the Server, but the nice thing about PHP Desktop is that includes a WebServer and a Browser in one package which is easily installed with minimal effort by an end-user, without requiring knowledge of Webservers or PHP installations. There is no need to complicate installations by having a user install and configure a Webserver of some kind, and further complicate matters with with a PHP installation and configuration (of the correct version). This is all neatly packaged into PHP Desktop and runs "out of the box" upon installation.

I hope that explains why this feature would be very good to have.

@cztomczak
Copy link
Owner

Just FYI: Alternative solution could be that app installer created e.g. with Inno Setup installs both phpdesktop app and e.g. Apache web server as a service. Both phpdesktop web server and Apache web server would serve scrpts from the same phpdesktop/www/ directory. I believe this can all be automated using Inno Setup scripting, so that app installer installs phpdesktop and configures apache web server automatically and end user doesn't have to do a thing, just run the installer.

@QTMcKay
Copy link
Author

QTMcKay commented Jan 23, 2018

Sure that could be done, however, Apache increases the size of the Installer significantly, adds to the complexity of the Setup Script, and on Windows at least, results in having 2 or 3 Webservers running (Apache, Mongoose, and possibly IIS).

If PHP Desktop allowed for starting Mongoose as a Service, then it would be possible to have a single Webserver, with the correct version of PHP (ie. 7.1) with only certain Extensions installed and configured, a known version of Chrome, and little-to-no complexity added to the Setup Script, all in a small Installer package of < 40MB (depending on code size, much less).

@darkterminal
Copy link

I have pull example how to create Windows Print Service on start up and on shutdown application just feel free to take a look #305 may be it's help you to know how it's work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants