fix: forwards php_server root to try_files by AlliBalliBaba · Pull Request #1729 · php/frankenphp

@AlliBalliBaba

Should fix #1723

The root defined in php_server was never really forwarded to try_files, which led to potentially confusing behavior where the file_server root (coming from php_server) and the try_files root (coming from the caddy route) would differ.

@AlliBalliBaba

This behavior is probably also broken in the php_fast_cgi implementation

@henderkes

Looks good, we should also try to upstream this to Caddy.

henderkes

TryFiles: tryFiles,
TryPolicy: tryPolicy,
SplitPath: extensions,
Root: phpsrv.Root,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one question though because I currently can't test it - this still falls back to Caddy's root if the one in phpsrv is empty?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it will fallback, an empty string is the default in the struct (otherwise tests would also fail)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add some more tests for all cases

@AlliBalliBaba

@AlliBalliBaba

@AlliBalliBaba

Hmm not sure if this is also an issue upstream since the file_server is not built in in that case. Would need to actually test with an actual installation.

@dunglas dunglas deleted the fix/php-server-root branch

July 16, 2025 09:58

@dunglas