caddy Not restart php-cgi.exe

Created on 12 Jan 2019  路  5Comments  路  Source: caddyserver/caddy

1. What version of Caddy are you using (caddy -version)?

Caddy 0.11.1

2. What are you trying to do?

Use php-5.6.40-nts-Win32-VC11-x64 on Windows 7 x64.

3. What is your entire Caddyfile?

*:15156 {
    gzip
    on startup php-5.6.40-nts-Win32-VC11-x64\php-cgi.exe -b 15155 &
    root web_root
    fastcgi / 127.0.0.1:15155 php
}

4. How did you run Caddy (give the full command and describe the execution environment)?

start caddy with a windows services by winsw

5. Please paste any relevant HTTP request(s) here.

just open browser and refresh quickly or kill php-cgi.exe by manual.

6. What did you expect to see?

some times php-cgi.exe was crash or been killed. but caddy donot restart php-cgi.exe. so I can't access php file. [static html can access ok]

7. What did you see instead (give full error messages and/or log)?

restart php-cgi.exe when php-cgi.exe was crash

Most helpful comment

That thread has info related to that: https://caddy.community/t/fix-php-cgi-exe-quits-after-exactly-500-hits-on-windows-or-502-bad-gateway-errors/4787

These details should be pinned or added to the docs. Took me some time to find how to do it and it's a common issue on Windows.

All 5 comments

The startup event only gets run at Caddy's startup time. It's not intended for it to keep a process alive. You should wrap your startup script with a simple batch script which can do the job of respawning php-cgi when you need it to, or use nssm (see here: https://github.com/mholt/caddy/wiki/Caddy-as-a-service-examples) to run it as a service to keep it alive.

Next time, please ask on https://caddy.community/ for any usage questions. This is the issues and bugs board.

That thread has info related to that: https://caddy.community/t/fix-php-cgi-exe-quits-after-exactly-500-hits-on-windows-or-502-bad-gateway-errors/4787

These details should be pinned or added to the docs. Took me some time to find how to do it and it's a common issue on Windows.

ok, thanks!

@magikstm maybe you could update the example here https://github.com/caddyserver/examples/tree/master/winphp with some more info

@francislavoie thanks for the suggestion. I created an issue on it https://github.com/caddyserver/examples/issues/147. And submitted a PR https://github.com/caddyserver/examples/pull/148.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

muhammadmuzzammil1998 picture muhammadmuzzammil1998  路  3Comments

dafanasiev picture dafanasiev  路  3Comments

kilpatty picture kilpatty  路  3Comments

wayneashleyberry picture wayneashleyberry  路  3Comments

jgsqware picture jgsqware  路  3Comments