Shutdown stops the workers and the PHP runtime.
()
| 360 | |
| 361 | // Shutdown stops the workers and the PHP runtime. |
| 362 | func Shutdown() { |
| 363 | if !isRunning { |
| 364 | return |
| 365 | } |
| 366 | |
| 367 | // call the shutdown hooks (mainly useful for extensions) |
| 368 | for _, fn := range onServerShutdown { |
| 369 | fn() |
| 370 | } |
| 371 | |
| 372 | drainWatchers() |
| 373 | drainAutoScaling() |
| 374 | drainPHPThreads() |
| 375 | |
| 376 | metrics.Shutdown() |
| 377 | |
| 378 | // Remove the installed app |
| 379 | if EmbeddedAppPath != "" { |
| 380 | _ = os.RemoveAll(EmbeddedAppPath) |
| 381 | } |
| 382 | |
| 383 | isRunning = false |
| 384 | if globalLogger.Enabled(globalCtx, slog.LevelDebug) { |
| 385 | globalLogger.LogAttrs(globalCtx, slog.LevelDebug, "FrankenPHP shut down") |
| 386 | } |
| 387 | |
| 388 | resetGlobals() |
| 389 | } |
| 390 | |
| 391 | // ServeHTTP executes a PHP script according to the given context. |
| 392 | func ServeHTTP(responseWriter http.ResponseWriter, request *http.Request) error { |