2021-09-24 16:52:20 +00:00
|
|
|
# Contributing
|
|
|
|
|
2022-10-04 12:36:03 +00:00
|
|
|
## Running the test suite
|
2021-09-24 16:52:20 +00:00
|
|
|
|
2022-10-04 12:36:03 +00:00
|
|
|
go test -race -v ./...
|
|
|
|
|
|
|
|
## Testing in live
|
|
|
|
### With Docker (Linux)
|
|
|
|
|
|
|
|
Prepare a dev Docker image:
|
|
|
|
|
|
|
|
docker build -t frankenphp .
|
|
|
|
docker run -p 8080:8080 -p 443:443 -v $PWD:/go/src/app -it frankenphp bash
|
|
|
|
|
|
|
|
#### Caddy module
|
|
|
|
|
|
|
|
Build Caddy with the FrankenPHP Caddy module:
|
|
|
|
|
|
|
|
cd /go/src/app/caddy/frankenphp/
|
|
|
|
go build
|
|
|
|
|
|
|
|
Run the Caddy with the FrankenPHP Caddy module:
|
|
|
|
|
|
|
|
cd /go/src/app/testdata/
|
|
|
|
../caddy/frankenphp/frankenphp run
|
|
|
|
|
|
|
|
#### Minimal test server
|
|
|
|
|
|
|
|
Build the minimal test server:
|
|
|
|
|
|
|
|
cd /go/src/app/internal/testserver/
|
|
|
|
go build
|
|
|
|
|
|
|
|
Run the test server:
|
|
|
|
|
|
|
|
cd /go/src/app/testdata/
|
|
|
|
../internal/testserver/testserver
|
|
|
|
|
|
|
|
The server is listening on `127.0.0.1:8080`:
|
|
|
|
|
|
|
|
curl http://127.0.0.1:8080/phpinfo.php
|
|
|
|
|
|
|
|
### Without Docker (Linux and macOS)
|
|
|
|
|
|
|
|
Compile PHP:
|
|
|
|
|
|
|
|
./configure --enable-debug --enable-zts
|
|
|
|
make -j6
|
|
|
|
sudo make install
|
|
|
|
|
|
|
|
Build the minimal test server:
|
|
|
|
|
|
|
|
cd internal/testserver/
|
|
|
|
go build
|
|
|
|
|
|
|
|
Run the test app:
|
|
|
|
|
|
|
|
cd ../../testdata/
|
|
|
|
../internal/testserver/testserver
|
2022-10-13 16:05:22 +00:00
|
|
|
|
|
|
|
## Misc Dev Resources
|
|
|
|
|
|
|
|
* [PHP embedding in uWSGI](https://github.com/unbit/uwsgi/blob/master/plugins/php/php_plugin.c)
|
|
|
|
* [PHP embedding in NGINX Unit](https://github.com/nginx/unit/blob/master/src/nxt_php_sapi.c)
|
|
|
|
* [PHP embedding in Go (go-php)](https://github.com/deuill/go-php)
|
|
|
|
* [PHP embedding in Go (GoEmPHP)](https://github.com/mikespook/goemphp)
|
|
|
|
* [PHP embedding in C++](https://gist.github.com/paresy/3cbd4c6a469511ac7479aa0e7c42fea7)
|
|
|
|
* [Extending and Embedding PHP by Sara Golemon](https://books.google.fr/books?id=zMbGvK17_tYC&pg=PA254&lpg=PA254#v=onepage&q&f=false)
|
|
|
|
* [What the heck is TSRMLS_CC, anyway?](http://blog.golemon.com/2006/06/what-heck-is-tsrmlscc-anyway.html)
|
|
|
|
* [PHP embedding on Mac](https://gist.github.com/jonnywang/61427ffc0e8dde74fff40f479d147db4)
|
|
|
|
* [SDL bindings](https://pkg.go.dev/github.com/veandco/go-sdl2@v0.4.21/sdl#Main)
|