Running PHP Built-in Server as a Background Process with nohup
This article explains how to start PHP's built‑in HTTP server for local testing, keep it running after the terminal closes by using nohup, and notes the default log file and production‑environment limitations.
Since PHP 5.4.0, a built‑in HTTP server can be started with php -S ip:port for local testing.
When the terminal is closed, the server stops, which is inconvenient for longer sessions.
A simple trick is to run the server as a background process using nohup php -S ip:port & , which keeps it alive after the terminal exits.
The default log file created by nohup is nohup.out in the current directory, but it can be redirected elsewhere.
Note that the php -S command is intended only for development and should not be used in production environments.
php中文网 Courses
php中文网's platform for the latest courses and technical articles, helping PHP learners advance quickly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.