Compiling PHP from source so it's Caddy-friendly

Hello - I am r&d’ing Caddy as an alternative to Nginx + PHP-FPM. I compile Nginx and PHP from source, with various configure options on both. The intention is vanilla web serving for PHP apps, no reverse proxying etc.

Regarding PHP compilation, I am interested in the recommended settings to make Caddy sing sweetly. These could be ZTS / non-ZTS settings, or anything else that’s relevant.

I have included the help template below, though there’s little useful info in there given my situation.

Thank you in advance, and best wishes.

1. The problem I’m having:

I would like to optimise PHP-FPM compilation so I can fairly compare / contrast Nginx + PHP-FPM & Caddy + PHP-FPM.

2. Error messages and/or full log output:

Not applicable.

3. Caddy version:

Not applicable.

4. How I installed and ran Caddy:

Not applicable.

a. System environment:

Debian 12 on aarch64 and x64.

b. Command:

Not applicable.

c. Service/unit/compose file:

Not applicable.

d. My complete Caddy config:

Not applicable.

5. Links to relevant resources:

Not applicable.

Have you seen https://frankenphp.dev/ ? That’s probably the route you should go. It’s a custom distribution of Caddy with PHP compiled in.

2 Likes

Hello Francis - thank you very much. I already have FrankenPHP on my testing list, and I’m tuning a ZTS build of PHP to give it a fair test against Nginx. I was really curious if there was any specific guidance from the Caddy camp as to best routes to run native Caddy + PHP. If the answer is “use FrankenPHP”, then I’ll do that!

No specific recommendations. There’s nothing special about Caddy’s fastcgi, it should work about the same as Nginx.

2 Likes

Perfect – thank you, Francis.