From 66bae588dd6d701f63a383ab474c6cdf263f6757 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Thu, 26 Sep 2019 13:04:07 -0700 Subject: [PATCH] Add document for php development (#6694) * Add document for php development * Fix comments --- php/README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/php/README.md b/php/README.md index e307768dc1..016747678f 100644 --- a/php/README.md +++ b/php/README.md @@ -95,3 +95,45 @@ Known Issues * HHVM not tested. * C extension not tested on windows, mac, php 7.0. * Message name cannot be Empty. + +## Development + +### Docker Image + +We provide a docker image for php development, which is also used in our automatic tests: +``` +docker run --security-opt seccomp=unconfined -it protobuftesting/php_8dbe419c6df1a8b3af0ae3a267c112efb436b45c +``` + +### Test Native PHP + +``` +# Download protobuf +git clone https://github.com/protocolbuffers/protobuf.git +cd protobuf + +# Build protoc +./autogen.sh +./configure +make -j4 + +# Test native php +cd php +composer install +composer test +``` + +### Test C Exteinsion + +After you have finished testing the native php, you can test the c exteniosn: +``` +cd tests +./test.sh 5.6 # The php runtime version. + # We provide 5.5, 5.5-zts, 5.6, 5.6-zts, 7.0, 7.0-zts, 7.1, 7.1-zts, 7.2, 7.2-zts, 7.3 and 7.3-zts + # ls /usr/local for more details +``` + +If you want to use gdb to debug the c extension, you can do: +``` +./gdb_test.sh +```