Git Product home page Git Product logo

node-fpm's Introduction

node-fpm

Help node.js code visit PHP, and manage PHP workers like Fast PHP Manager (PHP FPM). Use PHP-CGI directly through FastCGI protocol.

Development Status

Developing. Would be stable soon.

API

npm install node-fpm. Use require('node-fpm') to get a fpmServiceCreator.

var fpmService = fpmServiceCreator(options) Create an FPM service. Available options:

  • portMin The min value of port used by PHP-CGI, default to 9001.
  • portMax The max value of port used by PHP-CGI, default to 9099.
  • workers The PHP-CGI workers to start, range 1 to max available ports, default to 4.
  • maxReqsPerWorker The maximum requests to a worker before it is restarted, range 1 to 65535, default to 500.

fpmService.request(params, cb) Create a new request. An error object would be passed to cb as 1st argument on failed, otherwise a request argument is passed as 2nd argument.

The request object:

  • request.abort() Send an abort request. The request is not ended after the server responds.
  • request.stdin The writable stdin stream.
  • request.stdout The readable stdout stream.
  • request.stderr The readable stderr stream.
  • request.getExitStatus() Return exit code, or an error if not normally ended. It would be ready before the end events of stdout and stderr streams.

test

You should have PHP-CGI installed and available as "php-cgi" command.

Then use npm test to test. Use npm run coverage to see the test coverage.

LICENSE

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.