suggestion about compile.md

Open Beginner friendly
#601 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Quiet
Tech stack
go, php

Research direction

Start with compile.md and compare its existing run instructions with the reported commands for multiple PHP versions. Document the required PHP library path when php-config cannot resolve libphp, then verify that the documented command matches the working example and lets the project run.

Written by the indexing model from the issue text.

Description

enhancement
Describe you feature request

Is your feature request related to a problem? Please describe.
When I have multiple versions of PHP installed (php7.4, php8.1, php8.3), I execute the run command:

CGO_CFLAGS=$(php-config --includes) CGO_LDFLAGS="$(php-config --ldflags) $(php-config --libs)" go run .

It prompts:

# github.com/dunglas/frankenphp/caddy/frankenphp
/home/circle/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.0.linux-amd64/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -lphp
collect2: error: ld returned 1 exit status

Describe the solution you'd like
This error indicates that the ld encountered a problem when trying to link the libphp library. After I changed it to this, the program can run:

CGO_CFLAGS=$(php-config --includes) CGO_LDFLAGS="$(php-config --ldflags) -L/usr/local/php8.3/lib -lphp $(php-config --libs)" go run . run

Should this be written into compile.md?

Dominant language
Go
Stars
11.3k
Forks
488
Avg merge
2d 4h
Merged PRs (30d)
13

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from php/frankenphp

All issues in php/frankenphp

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.