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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

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

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.