Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Run and Execute PHP, JS, Ruby, Python 2, Python 3, ASPX, JSP, and CGI in CGI mode / Shell mode / nodejs server using node.js npm package / module phpcgijs: npm install phpcgijs --save

License

Notifications You must be signed in to change notification settings

cgi-js/node-php-cgi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NodePHP - run wordpress (and other php scripts) with node

With Node PHP you can leverage the speed of node js and run all of the widely available php scripts directly inside your express site.

Installation

npm install node-php

Usage

To run wordpress with node js and express do this:

var express = require('express');
var php = require("node-php"); 
var path = require("path"); 

var app = express();

// Following works without a local PHP-CGI path and tries to use PHP-CGI installed in system by default
// app.use("/", php.cgi("/path/to/wordpress"), ''); 

// Following uses a path in second argument defining the local copy of PHP-CGI that you want to use for the application
app.use("/", php.cgi("/path/to/wordpress"), '/usr/bin/'); 

app.listen(9090);

console.log("Server listening!");

Explanation

The script will pipe all files that end in the .php extension through the php parser. All other files will be served as static content.

Basic permalinks are supported but the support for them can probably be improved.

Dependencies

php-cgi

  • You need to have the interpreter installed in the system in order to use this extension.
  • Alternatively, You can specify the full path of locally available php-cgi path. If custom path not specified in express, it tries to find the system installed php-cgi executable. If still unavailable, the server errors out.

License

Copyright © 2014-2016 Martin K. Schröder [email protected]

The MIT License (MIT) - See LICENSE for further details.

About

Run and Execute PHP, JS, Ruby, Python 2, Python 3, ASPX, JSP, and CGI in CGI mode / Shell mode / nodejs server using node.js npm package / module phpcgijs: npm install phpcgijs --save

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 97.5%
  • PHP 2.5%