Go to file
2021-11-01 15:38:12 +01:00
caddy feat: better public API 2021-11-01 15:38:12 +01:00
testdata feat: Caddy module 2021-11-01 00:18:30 +01:00
.gitignore feat: Caddy module 2021-11-01 00:18:30 +01:00
CONTRIBUTING.md initial commit 2021-09-24 18:52:20 +02:00
Dockerfile initial commit 2021-09-24 18:52:20 +02:00
frankenphp_test.go feat: better public API 2021-11-01 15:38:12 +01:00
frankenphp.c feat: better public API 2021-11-01 15:38:12 +01:00
frankenphp.go feat: better public API 2021-11-01 15:38:12 +01:00
frankenphp.h feat: Caddy module 2021-11-01 00:18:30 +01:00
go.mod feat: Caddy module 2021-11-01 00:18:30 +01:00
go.sum feat: Caddy module 2021-11-01 00:18:30 +01:00
README.md feat: Caddy module 2021-11-01 00:18:30 +01:00

Caddy PHP

Install

Docker

The easiest way to get started is to use our Docker image:

docker build -t frankenphp .

Compile fron Sources

Install PHP

Most distributions doesn't provide packages containing ZTS builds of PHP. Because the Go HTTP server uses goroutines, a ZTS build is needed.

Start by downloading the latest version of PHP, then follow the instructions according to your operating system.

Linux
./configure --enable-embed --enable-zts
make
make install
Mac
brew install libiconv
./configure \
    --enable-zts \
    --enable-embed=static \
    --with-iconv=/opt/homebrew/opt/libiconv/ \
    --without-pcre-jit
make
make install

Then, you also need to build a Mac-compatible PHP shared library. As the standard PHP distribution doesn't provide one, you need to do a few extra steps:

Start by adding those lines at the end of the Makefile:

libs/libphp.dylib: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
	$(LIBTOOL) --mode=link $(CC) -dynamiclib $(LIBPHP_CFLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
	-@$(LIBTOOL) --silent --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1

Then run:

make libs/libphp.dylib
sudo cp libs/libphp.dylib /usr/local/lib/

Compile the Go App

go get -d -v ./...
go build -v

Misc Dev Resources