Backend Development 2 min read

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.

php中文网 Courses
php中文网 Courses
php中文网 Courses
Running PHP Built-in Server as a Background Process with nohup

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.

Backend DevelopmentPHPBuilt-in ServerLocal Testingnohup
php中文网 Courses
Written by

php中文网 Courses

php中文网's platform for the latest courses and technical articles, helping PHP learners advance quickly.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.