Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dunglas/php-dev-docker
Docker image to hack the PHP interpreter
https://github.com/dunglas/php-dev-docker
Last synced: 12 days ago
JSON representation
Docker image to hack the PHP interpreter
- Host: GitHub
- URL: https://github.com/dunglas/php-dev-docker
- Owner: dunglas
- Created: 2023-06-29T12:21:17.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-04T21:26:45.000Z (5 months ago)
- Last Synced: 2024-10-04T11:45:09.435Z (about 1 month ago)
- Language: Dockerfile
- Size: 2.93 KB
- Stars: 69
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker Image to Hack the PHP Interpreter
A convenient Docker image to track PHP bugs (segmentation faults), to develop extensions or the PHP interpreter itself.
## Build
```
git clone https://github.com/dunglas/php-dev-docker
cd php-dev-docker
docker build -t php-dev .
```## Run
Basic usage:
```
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -it php-dev
```### Debug a Local PHP Script Using GDB
```
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:
* [Debugging PHP with GDB (PHP Internals Book)](https://www.phpinternalsbook.com/php7/debugging.html)
* [GDB User Manual](https://sourceware.org/gdb/current/onlinedocs/gdb.html/)### Use Your Custom Forks of C Projects
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
```## Tools Included
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## Credits
Created by [Kévin Dunglas](https://dunglas.dev).
Sponsored by [Les-Tilleuls.coop](https://les-tilleuls.coop).