Giter Site home page Giter Site logo

connect-fastcgi's Introduction

What

connect middleware to pass requests to FastCGI server process.

Why

Because PHP-FPM. Yes, that's right, it's insanity, but I need it, mainly for development and automated testing tasks I do with grunt and simple node.js scripts.

This module is a stripped down version of this https://github.com/davidcoallier/node-php server converted to connect middleware. It was then modified to support POST and PUT, pass required headers etc.

How

var connect = require('connect'), 
    php = require('../connect-fastcgi');

var app = connect()
        .use('/php', php({ fastcgiPort: 8002, fastcgiHost: 'localhost', root: "./php" }))
        .use(connect.logger())
        .use(connect.static('./assets'))
        .listen(3000);

Available options:

  • root: root directory for scripts
  • fastcgiHost: host or socket path to FastCGI process
  • fastcgiPort: port

Thanks

David Coallier for original node-php module

connect-fastcgi's People

Contributors

oleics avatar pashky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

connect-fastcgi's Issues

Specify RegExp for parsing the URL into script_filename and path_info

I am working with a Yii app, and I just realized that this module bluntly assumes that request.url will be the script filename. Current and modern apps tend to use something like mysite.com/articles/this-one-thing. Internally, it resolves into /index.php/article/.... To parse it, one can use this simple regexp pattern:

var matches = "/index.php/app/site".match(/(.+\.php)(.+)/),
      script_filename = matches[1],
      path_info = matches[2];

I'd suggest enabling the ability to pass and enable a matching pattern.

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.