I recently got interested in the WebSocket technology. I built myself a server using PHP which I ran on Windows using the PHP CLI. That was fine for development, but now I need to think about deployment.
I got myself a little VPS running Ubuntu Server 10.10. I have basic knowledge of Linux, so I set up my SSH client, installed PHP-CLI and messed around to make sure it works, which it does.
Now, I can simply run my server using
php server.php
But I don't think that's a great way of doing it. A few concerns:
- What will happen to the console output once I close my SSH client?
- What if the server crashes?
- I can't do anything else on my VPS while the server is running this way in the main thread
Regarding the console output; is there a way to redirect STDOUT or something to a file, so I can still see the console output on Windows but on my VPS it is logged instead? As for the server crashes, what are some good ways to restart some processes automatically on server boot? And I think I could run it as a daemon or a service or something like that so it doesn't hang the main thread?
So, what are some usually used solutions for those problems? Is there somewhere I can read up more on this? I'd like to learn a little bit in the process!
@LGB: I'll look into it, thanks!
– Xeon06 Feb 16 '11 at 23:152>1&
in the command line should be2>&1
, if I read the following text right. – Paŭlo Ebermann Feb 20 '11 at 00:47