Develop PHP based applications. Includes needed tools, extensions, and dependencies.
| Options Id | Description | Type | Default Value |
|---|---|---|---|
| imageVariant | PHP version (use -bookworm, -bullseye variants on local arm64/Apple Silicon): | string | 8.5-trixie |
This template references an image that was pre-built to automatically include needed devcontainer.json metadata.
- Image: mcr.microsoft.com/devcontainers/php (source)
- Applies devcontainer.json contents from image: Yes (source)
This dev container includes Apache in addition to the PHP CLI. While you can use PHP's built in CLI (e.g. php -S 0.0.0.0:8080), you can start Apache by running:
apache2ctl startApache will be available on port 8080.
If you want to wire in something directly from your source code into the www folder, you can add a symlink as follows to postCreateCommand:
"postCreateCommand": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html"...or execute this from a terminal window once the container is up:
sudo chmod a+x "$(pwd)" && sudo rm -rf /var/www/html && sudo ln -s "$(pwd)" /var/www/htmlNote: This file was auto-generated from the devcontainer-template.json. Add additional notes to a NOTES.md.