Skip to content

Commit 340848a

Browse files
author
Ganesh K Bhat
committed
[COMMIT] Adding cgijs as an inbuilt dependancy of phpcgijs
1 parent d24d264 commit 340848a

File tree

4 files changed

+3679
-76
lines changed

4 files changed

+3679
-76
lines changed

README.md

Lines changed: 63 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11

2-
NodeCGIEmbedded - run php scripts like wordpress, drupal, etc with node and cgi counter parts
3-
---------------------------------------------------------
2+
# phpcgijs
43

5-
With Node PHP Embedded you can leverage the speed of node js and run all of the widely available php scripts directly inside your express site.
4+
#### Run php scripts like wordpress, drupal, etc with node and cgi counter parts
5+
----------------------------------------------------------------------------
66

7-
This is a fork of http://github.com/mkschreder/node-php and has been modified for making this take dynamic PHP pathing, so that it can run without a PHP distribution installed on a machine and can work with an embedded PHP binary distribution.
7+
With Node PHP Embedded, you can leverage the speed of node.js and run all of the widely available php scripts directly inside your express site.
88

99

10+
This was originally a fork of http://github.com/mkschreder/node-php and has been modified for making this take dynamic PHP pathing, so that it can run without a PHP distribution installed on a machine and can work with an embedded PHP binary distribution.
11+
1012

1113
Installation
1214
------------
@@ -15,8 +17,32 @@ Installation
1517
npm install phpcgijs --save
1618
```
1719

18-
Usage
19-
-----
20+
21+
22+
Includes CGIJS Library as a dependancy
23+
---------------------------------------
24+
25+
# cgijs
26+
27+
28+
#### Usage as `require("phpcgijs").cgijs` inbuilt dependency library APIs
29+
-------------------------------------------------------------------------
30+
31+
*`CGIJS` is a library to run any `CGI` mode / `Interpreted language script` files, or connect to any web application server proxies, or manage processes in the system.*
32+
33+
34+
`CGIJS` library:
35+
36+
- Supports running any `CGI` / `Interpreted Language scripts` in `any OS` that runs `node.js`.
37+
- Supports both `CGI` executables as well as `proxy` to `localhost`/ `remote` /`embedded servers` using proxying of multiple protocols (`http`, `websockets`, `tcp`, `udp`, `socks`, `ssh`, `ftp`).
38+
- Supports managing processes like `embedded` `server` executables, embedded `database` executables, or `any other` embedded/ non-embedded executables
39+
40+
41+
You can view more about `cgijs` at [github.com/cgi-js](https://github.com/cgi-js/cgi-js) or install it directly at [npm cgijs](https://www.npmjs.com/package/cgijs)
42+
43+
44+
#### Usage as `require("phpcgijs").cgi` inbuilt dependency library APIs
45+
-------------------------------------------------------------------------
2046

2147
To run php scripts with node js and express create the following script like below:
2248

@@ -65,24 +91,50 @@ console.log("Server listening at 9090!");
6591

6692
```
6793

94+
95+
6896
Explanation
6997
-----------
7098

71-
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.
99+
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.
100+
101+
You can also use the inbuilt `cgijs` API using the following features using the `require("phpcgijs").cgijs` API.
72102

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

75104
Dependencies
76105
------------
77106

78-
# php-cgi
107+
108+
#### Inbuilt phpcgijs `.cgi` usage
109+
-----------------------------------
110+
79111

80112
* You need to have the interpreter installed in the system in order to use this extension.
81113
* Alternatively, You can specify the full path of locally available php-cgi path.
82114
* If custom path not specified in express, it tries to find the system installed php-cgi executable. If still unavailable, the server errors out.
83115
* TODO:
84-
- Add php.ini path config
85-
- app.use("/", php.cgi("/path/to/phpscript", "to/php/cgi/path", '/path/to/php.ini'));
116+
- Add `php.ini` path config
117+
- `app.use("/", php.cgi("/path/to/phpscript", "to/php/cgi/path", '/path/to/php.ini'));`
118+
119+
120+
#### Inbuilt phpcgijs `.cgijs` usage
121+
-------------------------------------
122+
123+
124+
##### Node CGI Embedded - run interpreted scripts that support cgi using nodejs
125+
* [x] CGI file execution - Run any scripts that support CGI based serving/execution
126+
127+
##### Node Web Proxy - run web proxies
128+
* [x] Running Proxies - Run any host that serves a web app, using proxy (HTTP, UDP, TCP, Websockets, Socks) and supports websocket implementation in web proxies
129+
130+
##### Node Processes - Manage web servers, database processes, or other system processes or services
131+
* [x] Manage Processes or Services - Allows running and closing process Executables
132+
133+
##### CGIJS Functionality Details
134+
* [x] The script should support piping all files of below interpreted languages including Python (2.x, 3.x) - `py`, Perl (Version Independent) - `plc`, `pld`, `pl`, PHP (Version Independent) - `php`, Ruby (Version Independent) - `rb`, Node.js (Version Independent) - `js`, CGI files - `cgi`.
135+
* [x] The script should support piping all proxies of above languages and Jsp (With Tomcat, or any webserver as proxy) , Aspx (With IIS, Apache, or any webserver as proxy), Jsp and Aspx (With Tomcat, Nginx, and Apache embedded)
136+
* [x] Some sections are pending to be tested but should function normally
137+
86138

87139
License
88140
-------

main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,5 @@ exports.cgi = function (www_root, exe_config) {
272272
}.bind(exe_config))
273273
}.bind(exe_config);
274274
};
275+
276+
exports.cgijs = require("cgijs");

0 commit comments

Comments
 (0)