Home  >  Article  >  Backend Development  >  An interesting command: php -S (tip sharing)

An interesting command: php -S (tip sharing)

藏色散人
藏色散人forward
2022-08-10 13:59:534241browse

An interesting command: php -S (tip sharing)

We know that PHP has a built-in http server starting from 5.4.0. Developers can use this built-in server to do some local testing. How is it started?

The startup method is as follows:

php -S ip:port

With this kind of startup, if the service stops after closing the current terminal... What should I do?

Here is a little trick that we can do to turn it into a process that always runs in the background:

nohup php -S ip:port &

The default log is in the current directory, and the default name is nohup. out, you can redirect to other places!

Note that php -S is only suitable for local debugging and cannot be used in production environments.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of An interesting command: php -S (tip sharing). For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete