Go to file
2021-09-24 18:52:20 +02:00
cmd/frankenphp initial commit 2021-09-24 18:52:20 +02:00
testdata initial commit 2021-09-24 18:52:20 +02:00
.gitignore initial commit 2021-09-24 18:52:20 +02:00
caddy_test.go initial commit 2021-09-24 18:52:20 +02:00
caddy.go initial commit 2021-09-24 18:52:20 +02: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 initial commit 2021-09-24 18:52:20 +02:00
frankenphp.c initial commit 2021-09-24 18:52:20 +02:00
frankenphp.go initial commit 2021-09-24 18:52:20 +02:00
frankenphp.h initial commit 2021-09-24 18:52:20 +02:00
go.mod initial commit 2021-09-24 18:52:20 +02:00
go.sum initial commit 2021-09-24 18:52:20 +02:00
README.md initial commit 2021-09-24 18:52:20 +02: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=dylib \
    --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