https://github.com/tbreuss/phpsrv
Docker image providing a lightweight PHP development environment using PHP's built-in web server.
https://github.com/tbreuss/phpsrv
docker docker-alpine php php-builtin-server php-web-server
Last synced: about 1 month ago
JSON representation
Docker image providing a lightweight PHP development environment using PHP's built-in web server.
- Host: GitHub
- URL: https://github.com/tbreuss/phpsrv
- Owner: tbreuss
- License: mit
- Created: 2025-10-22T05:59:33.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-12-27T11:10:37.000Z (3 months ago)
- Last Synced: 2025-12-29T04:12:59.788Z (3 months ago)
- Topics: docker, docker-alpine, php, php-builtin-server, php-web-server
- Language: Dockerfile
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Docker Image using PHP's built-in Web Server
This Docker image provides a lightweight PHP development environment using PHP's built-in web server.
Based on the official Alpine PHP image, it's ideal for quickly spinning up ad hoc projects.
## Supported PHP Versions
- 8.5
- 8.4
- 8.3
- 8.2
Older versions should also work.
## Build Image
Build Docker image based on the latest supported PHP version.
docker build -t phpsrv:8.5 https://github.com/tbreuss/phpsrv.git
Optionally, you can also use an older PHP version.
docker build --build-arg PHP_VERSION=8.4 -t phpsrv:8.4 https://github.com/tbreuss/phpsrv.git
docker build --build-arg PHP_VERSION=8.3 -t phpsrv:8.3 https://github.com/tbreuss/phpsrv.git
docker build --build-arg PHP_VERSION=8.2 -t phpsrv:8.2 https://github.com/tbreuss/phpsrv.git
## Apply Image
Start your project as follows:
docker run --rm -v .:/app -p 8888:8888 phpsrv:8.5
If you have a specific document root directory:
project/
├─ your-code/
└─ web/
└─ index.php
Then you can start your project as follows:
docker run --rm -v .:/app -p 8888:8888 phpsrv:8.5 php -S 0.0.0.0:8888 -t /app/web
And if you want to use Xdebug, here's how to do it:
docker run --rm -e XDEBUG_CONFIG="client_host=172.17.0.1" -e XDEBUG_MODE=debug -e XDEBUG_SESSION_START=true -v .:/app -p 8888:8888 phpsrv:8.5 php -S 0.0.0.0:8888 -t /app/web
Note: On macOS, the `client_host` setting should be `host.docker.internal`.
To start the container with an interactive terminal session, run the following command:
docker run --rm -it -v .:/app phpsrv:8.5 ash