caddy

package module
v1.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2025 License: MIT Imports: 34 Imported by: 4

Documentation

Overview

Package caddy provides a PHP module for the Caddy web server. FrankenPHP embeds the PHP interpreter directly in Caddy, giving it the ability to run your PHP scripts directly. No PHP FPM required!

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterWorkers added in v1.10.0

func RegisterWorkers(name, fileName string, num int, wo ...frankenphp.WorkerOption) frankenphp.Workers

EXPERIMENTAL: RegisterWorkers provides a way for extensions to register frankenphp.Workers

Types

type FrankenPHPAdmin added in v1.5.0

type FrankenPHPAdmin struct{}

func (FrankenPHPAdmin) CaddyModule added in v1.5.0

func (FrankenPHPAdmin) CaddyModule() caddy.ModuleInfo

if the id starts with "admin.api" the module will register AdminRoutes via module.Routes()

func (FrankenPHPAdmin) Routes added in v1.5.0

func (admin FrankenPHPAdmin) Routes() []caddy.AdminRoute

EXPERIMENTAL: These routes are not yet stable and may change in the future.

type FrankenPHPApp

type FrankenPHPApp struct {
	// NumThreads sets the number of PHP threads to start. Default: 2x the number of available CPUs.
	NumThreads int `json:"num_threads,omitempty"`
	// MaxThreads limits how many threads can be started at runtime. Default 2x NumThreads
	MaxThreads int `json:"max_threads,omitempty"`
	// Workers configures the worker scripts to start
	Workers []workerConfig `json:"workers,omitempty"`
	// Overwrites the default php ini configuration
	PhpIni map[string]string `json:"php_ini,omitempty"`
	// The maximum amount of time a request may be stalled waiting for a thread
	MaxWaitTime time.Duration `json:"max_wait_time,omitempty"`
	// contains filtered or unexported fields
}

FrankenPHPApp represents the global "frankenphp" directive in the Caddyfile it's responsible for starting up the global PHP instance and all threads

{
	frankenphp {
		num_threads 20
	}
}

func (FrankenPHPApp) CaddyModule

func (f FrankenPHPApp) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*FrankenPHPApp) Provision added in v1.4.3

func (f *FrankenPHPApp) Provision(ctx caddy.Context) error

Provision sets up the module.

func (*FrankenPHPApp) Start

func (f *FrankenPHPApp) Start() error

func (*FrankenPHPApp) Stop

func (f *FrankenPHPApp) Stop() error

func (*FrankenPHPApp) UnmarshalCaddyfile

func (f *FrankenPHPApp) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

type FrankenPHPModule

type FrankenPHPModule struct {

	// Root sets the root folder to the site. Default: `root` directive, or the path of the public directory of the embed app it exists.
	Root string `json:"root,omitempty"`
	// SplitPath sets the substrings for splitting the URI into two parts. The first matching substring will be used to split the "path info" from the path. The first piece is suffixed with the matching substring and will be assumed as the actual resource (CGI script) name. The second piece will be set to PATH_INFO for the CGI script to use. Default: `.php`.
	SplitPath []string `json:"split_path,omitempty"`
	// ResolveRootSymlink enables resolving the `root` directory to its actual value by evaluating a symbolic link, if one exists.
	ResolveRootSymlink *bool `json:"resolve_root_symlink,omitempty"`
	// Env sets an extra environment variable to the given value. Can be specified more than once for multiple environment variables.
	Env map[string]string `json:"env,omitempty"`
	// Workers configures the worker scripts to start.
	Workers []workerConfig `json:"workers,omitempty"`
	// contains filtered or unexported fields
}

FrankenPHPModule represents the "php_server" and "php" directives in the Caddyfile they are responsible for forwarding requests to FrankenPHP via "ServeHTTP"

example.com {
	php_server {
		root /var/www/html
	}
}

func (FrankenPHPModule) CaddyModule

func (FrankenPHPModule) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*FrankenPHPModule) Provision

func (f *FrankenPHPModule) Provision(ctx caddy.Context) error

Provision sets up the module.

func (*FrankenPHPModule) ServeHTTP

ServeHTTP implements caddyhttp.MiddlewareHandler.

func (*FrankenPHPModule) UnmarshalCaddyfile

func (f *FrankenPHPModule) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL