5

GitHub - dunglas/php-dev-docker: Docker image to hack the PHP interpreter

 1 year ago
source link: https://github.com/dunglas/php-dev-docker
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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 .

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:

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:

  • Valgrind
  • neovim
  • Caddy
  • OpenSSL

Credits

Created by Kévin Dunglas. Sponsored by Les-Tilleuls.coop.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK