I want to run a Javascript/PHP application on my laptop which will at times be unable to get to the internet. Thus I need to run a web server of some sort on it to serve the PHP side of things.
If the laptop is at home on the home LAN I want to be able to run the same Javascript/PHP application on my desktop machine so I can use the bigger screen etc. This will work fine of course with the web server on the laptop, as long as the web server is running.
What's the neatest/easiest way to fire up the web server on demand? I don't really want to run it all the time. Ideally also I'd prefer not to run Apache as it's total overkill for what I'm doing. I tried PHP's built-in web server ("php -S localhost:80") and it works fine for me, the home LAN can't be accessed from outside so security should be OK.
I suppose the modern equivalent of inetd would do what I want but I'm a bit worried about how easy it might be (or not).
On 26/03/16 16:21, Chris Green wrote:
What's the neatest/easiest way to fire up the web server on demand? I don't really want to run it all the time. Ideally also I'd prefer not to run Apache as it's total overkill for what I'm doing. I tried PHP's built-in web server ("php -S localhost:80") and it works fine for me, the home LAN can't be accessed from outside so security should be OK.
I suppose the modern equivalent of inetd would do what I want but I'm a bit worried about how easy it might be (or not).
I'm sort of tempted to say why bother ? if there are no requests hitting it then the PHP isn't executed, so you have one thread of Apache (or whatever) sleeping. Unless you are running it on hardware from the previous century you really won't notice the difference between it running or not.
Plus if it's not hardened for security do you really want it to autostart on a request when you are using your laptop in an internet cafe ?
Either run it all the time or just have some scripts linked to menu/desktop buttons to quick launch or kill it I say.
On Fri, Apr 15, 2016 at 06:41:05PM +0100, Wayne Stallwood wrote:
On 26/03/16 16:21, Chris Green wrote:
What's the neatest/easiest way to fire up the web server on demand? I don't really want to run it all the time. Ideally also I'd prefer not to run Apache as it's total overkill for what I'm doing. I tried PHP's built-in web server ("php -S localhost:80") and it works fine for me, the home LAN can't be accessed from outside so security should be OK.
I suppose the modern equivalent of inetd would do what I want but I'm a bit worried about how easy it might be (or not).
I'm sort of tempted to say why bother ? if there are no requests hitting it then the PHP isn't executed, so you have one thread of Apache (or whatever) sleeping. Unless you are running it on hardware from the previous century you really won't notice the difference between it running or not.
Plus if it's not hardened for security do you really want it to autostart on a request when you are using your laptop in an internet cafe ?
Either run it all the time or just have some scripts linked to menu/desktop buttons to quick launch or kill it I say.
Yes, that's what I've actually decided to do. It also means that I can have the same apache setup on laptop and desktop.
... and as you say it doesn't seem to affect performance at all.