package
1.5.0
Repository: https://github.com/hlpmenu/gofast.git
Documentation: pkg.go.dev

# README

phpfpm GoDoc

phpfpm is a minimalistic php-fpm process manager written in go.

It generates config file for a simple php-fpm process with 1 pool and listen to 1 address only.

This is a fringe case, I know. Just hope it might be useful for someone else.

Usage

package main

import "github.com/yookoala/gofast/tools/phpfpm"

func main() {

  fpm := phpfpm.NewProcess("/usr/sbin/php5-fpm")

  // config to save pidfile, log to "/home/foobar/var"
  // also have the socket file "/home/foobar/var/php-fpm.sock"
  fpm.SetDatadir("/home/foobar/var")

  // save the config file to basepath + "/etc/php-fpm.conf"
  fpm.SaveConfig(basepath + "/etc/php-fpm.conf")
  fpm.Start()

  go func() {

    // do something that needs fpm
    // ...
    fpm.Stop()

  }()

  // will wait for phpfpm to exit
  fpm.Wait()

}

License

This software is license under MIT License. You may find a copy of the license in this repository.

# Functions

FindBinary finds php-fpm binary in the given paths.
NewProcess creates a new process descriptor.
ReadPaths reads a UNIX $PATH (or otherwise formatted alike variable) and expand into an array of paths.

# Structs

Process describes a minimalistic php-fpm config that runs only 1 pool.