php-built-in-server-manager
php-built-in-server-manager copied to clipboard
Bash script to stop, start, restart PHP built-in web server
php-built-in-server-manager
Manage PHP built-in web server like a pro
usage: ./server <command> [<hostname>:<port>]
Available commands:
start Starts PHP built-in web server server on specified hostname:port, default is localhost:8080
stop Stops the PHP built-in web server
restart Stops and Starts on previously specified hostname:port
status Status of the process
log Show the PHP built-in web server logs. Use the -f option for a live update
How to Use it
This is a very basic script so you're not limitted to any specific method. I suggest one of these two:
- Copy
serverscript to root of your PHP project. - Copy/Symlink to your one of $PATH directories like
~/binor/usr/local/binand use it everywhere.
Note: When starts, two files server.pid and server.log will be created in current working directory and when stopped, only server.pid will be deleted but server.log remains.
the server script can be renamed to whatever you like. I personally prefer pmserver.
.pid and .log files will have the same name as the filename e.g. when server renames to pmserver there will be pmserver.pid and pmserver.log files