PHP development environment - apache php xdebug https composer
2.3K
A super light docker web server with Apache and php on top of Alpine Linux for development purposes
The docker image size is 59 MB.
Starting the container with docker-compose offer all container functionalities.
docker-compose up
CTRL-Z to detach
docker-compose stop
Alternatively the container can also be started with docker run.
docker run -p 80:80 --name web 8ct8pus/apache-php-alpine:latest
CTRL-Z to detach
docker stop container
http://localhost/
https://localhost/
The source code is located inside the html directory.
To set the domain name to www.test.com, edit the environment variable in the docker-compose file
environment:
- DOMAIN=www.test.com
Add this line to the system host file. Editing the file requires administrator privileges.
C:\Windows\System32\drivers\etc\hosts
127.0.0.1 test.net www.test.net
To remove "Your connection is not private" nag screens, import the certificate authority file under ssl/certificate_authority.pem in the browser's certificates under Trusted Root Certification Authorities.
This github repository is configured to debug php code in Visual Studio Code.
To start debugging, open the VSCode workspace then select Run > Start debugging then open the site in the browser.
For other IDEs, set the Xdebug debugging port to 9001.
The docker image is configured to profile php code.
To start profiling, add the XDEBUG_PROFILE variable to the request as a GET, POST or COOKIE.
http://localhost/?XDEBUG_PROFILE
Profiles are stored in the log directory.
docker exec -it web zsh
docker build -t apache-php-alpine:dev .
In this example, we add the php-curl extension.
docker-compose up --detach
docker exec -it web zsh
apk add php-curl
exit
docker-compose stop
docker commit web apache-php-alpine-curl:dev
To use the new image, update the image link in the docker-compose file.
In Windows hot reload doesn't work with WSL 2, you need to use the legacy Hyper-V.
Content type
Image
Digest
Size
24.9 MB
Last updated
almost 6 years ago
docker pull 8ct8pus/apache-php-alpine