Caddy v2+php-cgi on Windows

Hi everyone in the Caddy community. I met a wonderful project!

I changed my Windows 10 web server to Caddy. It was v2 and needed to use PHP.
I keep configuration files and shortcuts for those who want to do the same in the future.

I could not find such a description in the settings of “php_fastcgi”.

Please be aware of the reports available in Caddy v1+PHP on Windows.
This Caddy does little work… So I was fine with this setting.

Edit: I Added “Caddy shortcut”

1 Like

Thank you for sharing! And welcome to the project!

FWIW I’m writing v2 Caddyfile docs yesterday, this weekend, and into next week. So the documentation site will have Caddyfile docs by the end of next week.

What do you mean by this?

Please be aware of the reports available in Caddy v1+PHP on Windows.
This Caddy does little work… So I was fine with this setting.

What do you mean by this?

In some posts we have set the environment variable PHP_FCGI_MAX_REQUESTS=0.
It may also be needed in Caddy v2.

For example:

In connection with this, I found a bug and reported it to an issue on GitHub:
https://github.com/caddyserver/caddy/issues/2989

It was a specification, rather a modern implementation. (See GitHub issue for details)
I increasingly like Caddy. :grin:

1 Like

By this, do you mean that your PHP app has requirements that are more peculiar, i.e. common among older apps instead of newer ones?

Glad to hear it!

No. At the time of issue, I simply assumed that there was a .php file under Apache’s DocumentRoot.
Perhaps someone likes such a web server. (It’s the old way. but…)
I prefer the current specification of Caddy v2.

1 Like

EnvSet(“PHP_FCGI_CHILDREN”, 4)
EnvSet(“PHP_FCGI_MAX_REQUESTS”, 1000)
$hphp = Run(@ScriptDir & “\php\php-cgi.exe -b localhost:9000”, @ScriptDir & “\php”, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

PHP_FCGI_CHILDREN value must be at least 2. The reason is not sure, but without it you will see lots of strange “access blocks” or “server freeze” when your traffic ramps up.

This topic was automatically closed after 180 days. New replies are no longer allowed.