Running PHP-CLI server

General Tech Bugs & Fixes . 2 years ago

  0   1   0   0   0 tuteeHUB earn credit +10 pts

5 Star Rating 5 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Write Your Comments or Explanations to Help Others



Tuteehub forum answer Answers (1)


profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

Good day everyone,

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!

Thanks.

0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

tuteehub community

Join Our Community Today

Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.

tuteehub community