Skip to content

docs: clarify PHP library path for source builds - #2560

Closed
ousamabenyounes wants to merge 1 commit into
php:mainfrom
ousamabenyounes:docs/issue-601-linker
Closed

docs: clarify PHP library path for source builds#2560
ousamabenyounes wants to merge 1 commit into
php:mainfrom
ousamabenyounes:docs/issue-601-linker

Conversation

@ousamabenyounes

@ousamabenyounes ousamabenyounes commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Fix #601.

Changes

  • Add the selected PHP prefix library directory to the CGO_LDFLAGS example used with xcaddy, so the linker can find FrankenPHP's hard-coded -lphp when libphp is installed outside the default linker paths.
  • Mention that versioned php-config commands must be used consistently in the cgo flags.
  • Use the repository go.sh wrapper for the direct go build example, now that it owns the default build tags and php-config handling.

Validation

Verified in Docker with dunglas/frankenphp:1.12.6-builder-php8.5, Go 1.26.5 from the official Go image, and pinned xcaddy tag v0.4.5.

The build used the documented values:

CGO_CFLAGS="$(php-config --includes)"
CGO_LDFLAGS="$(php-config --ldflags) -L$(php-config --prefix)/lib $(php-config --libs)"
XCADDY_GO_BUILD_FLAGS="-ldflags=\"-w -s\" -tags=nobadger,nomysql,nopgx"
xcaddy build --output /tmp/frankenphp-doc-verify \
  --with github.com/dunglas/frankenphp=/src \
  --with github.com/dunglas/frankenphp/caddy=/src/caddy

Result:

Build complete: /tmp/frankenphp-doc-verify
/tmp/frankenphp-doc-verify version
v2.11.4 h1:XKxkMTgNSizEvKG6QHue6cAsFOteU2qA61w2tKkCWi0=

Also ran git diff --check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

suggestion about compile.md

1 participant