fpm

package
v0.0.0-...-3caf815 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package fpm 实现了php-fpm进程管理。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseExistProcess

func CloseExistProcess(pidfileName string) error

CloseExistProcess close php-fpm process already exist for this project

Types

type Config

type Config struct {
	FpmBin        string // phpfpm 可执行文件路径
	PhpConfigFile string // php.ini配置文件
	FpmConfigDir  string // php-fpm.conf配置文件目录
	WorkDir       string // 工作目录
	User          string // 执行用户
	Group         string // 执行用户组
	ErrorLogFile  string // fpm错误日志
	SlowLogFile   string // fpm 慢查询日志
	PIDFile       string // fpm pid file
	SocketFile    string // fpm socket file
	FpmConfigFile string // fpm config file

	PM              string                        // fpm进程管理方式
	MaxChildren     string                        // fpm最大子进程数目
	StartServers    string                        // fpm启动时进程数目
	MinSpareServers string                        // fpm最小空闲进程数数目
	MaxSpareServers string                        // fpm最大空闲进程数目
	SlowlogTimeout  string                        // fpm慢请求日志超时时间
	OutputHandler   func(typ LogType, msg string) // php-fpm 标准输出,标准错误输出处理器
}

Config Meta Fpm配置

type Fpm

type Fpm struct {
	// contains filtered or unexported fields
}

Fpm FPM进程管理对象

func NewFpm

func NewFpm(config *Config) *Fpm

NewFpm 创建一个PFM实例

func (*Fpm) GetNetworkAddress

func (fpm *Fpm) GetNetworkAddress() (network, address string)

GetNetworkAddress 获取监听的网络类型和地址

func (*Fpm) Kill

func (fpm *Fpm) Kill() error

Kill 停止fpm进程

func (*Fpm) Loop

func (fpm *Fpm) Loop(ok chan struct{}) error

Loop 循环检测fpm master是否挂掉,挂掉后自动重新启动

func (*Fpm) Reload

func (fpm *Fpm) Reload() error

Reload reload php-fpm process

type LogType

type LogType string
const (
	LogTypeStdout LogType = "stdout"
	LogTypeStderr LogType = "stderr"
)

type Meta

type Meta struct {
	FpmBin          string
	PidFile         string
	ErrorLog        string
	SlowLog         string
	Listen          string
	FpmConfigFile   string
	PhpConfigFile   string
	User            string
	Group           string
	PM              string // fpm进程管理方式
	MaxChildren     string // fpm最大子进程数目
	StartServers    string // fpm启动时进程数目
	MinSpareServers string // fpm最小空闲进程数数目
	MaxSpareServers string // fpm最大空闲进程数目
	SlowlogTimeout  string // fpm慢请求日志超时时间
	OutputHandler   func(typ LogType, msg string)
}

Meta 进程运行配置信息

type Process

type Process struct {
	Meta Meta
	// contains filtered or unexported fields
}

Process PHP-FPM进程管理器

func NewProcess

func NewProcess(meta Meta) *Process

NewProcess creates a new process descriptor

func (*Process) Address

func (proc *Process) Address() (network, address string)

Address 返回监听方式和地址

func (*Process) GetProcessMeta

func (proc *Process) GetProcessMeta() Meta

GetProcessMeta get process configuration info

func (*Process) Kill

func (proc *Process) Kill() error

Kill kill the process

func (*Process) PID

func (proc *Process) PID() int

PID get process pid

func (*Process) Reload

func (proc *Process) Reload() error

Reload reload php-fpm process

func (*Process) Start

func (proc *Process) Start() (err error)

Start 启动php-fpm主进程

func (*Process) UpdateConfigFile

func (proc *Process) UpdateConfigFile(configFile string)

UpdateConfigFile 更新或创建fpm配置文件

func (*Process) Wait

func (proc *Process) Wait() (err error)

Wait wait for process to exit

Jump to

Keyboard shortcuts

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