A convenient Docker image to track PHP bugs (segmentation faults), to develop extensions or the PHP interpreter itself.
git clone https://github.com/dunglas/php-dev-docker
cd php-dev-docker
docker build -t php-dev .
Basic usage:
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -it php-dev
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v ./:/app/ -it php-dev gdb php /app/my-script.php
Then, type r
to execute the script.
If the program segfaults, type bt
to get a backtrace.
More information:
Start the container with volumes containing your local sources of PHP, curl and/or nghttp2:
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v ~/workspace/php-src:/usr/src/php-src -v ~/workspace/curl:/usr/src/curl -v ~/workspace/nghttp2:/usr/src/nghttp2 -it php-dev
Base image: Debian
Libraries (Git repositories, and compiled versions with debug symbols):
- the PHP Interpreter
libcurl
nghttp2
Development tools:
- GCC
- LLVM
- GDB
- Valgrind
- neovim
- Git
- zsh
- Caddy
- OpenSSL
Created by Kévin Dunglas. Sponsored by Les-Tilleuls.coop.