GithubHelp home page GithubHelp logo

node.php's Introduction

Node.php

Ever wanted to deploy a node.js web app but didn't have money for a dedicated node.js hosting or didn't have time to set up a cloud PaaS? Have an existing PHP shared hosting based on the LAMP stack? Now you can run node.js on top of it!

Node.php originates from my ealier answer on Stack Overflow.

The node.php script installs an official node.js package, starts a hidden server on localhost:49999 with provided JS file and proxies all requests to it.

Warning! This is an alpha version, it may be insecure, run it at your own risk!

Requirements

A PHP web hosting based on Linux with safe mode off and the following functions enabled: curl_exec, exec, passthru.

How to run

  1. Put the node.php file in your public_html (or similar) folder, then install node.js by browsing to: http://example.org/node.php?install.
  2. When succeeded, install your node.js app by uploading its folder or using npm: http://example.org/node.php?npm=install jt-js-sample.
  3. When everything goes fine, start your node.js instance by going to: http://example.org/node.php?start=node_modules/jt-js-sample/index.js.
  4. Now you can request your app by browsing to: http://example.org/node.php?path=optional/request/path. This will return a response from the running node.js app at http://127.0.0.1:49999/optional/request/path.
  5. Finally, stop your node.js server by loading: http://example.org/node.php?stop.

Commands

node.php[?path=some/path] - serves an already running node.js app with an optional request path (no leading slash)

The following commands require the ADMIN_MODE set to true (line 13 of node.php):

node.php?install - downloads and extracts node.js into the node folder.

node.php?uninstall - removes the node folder

node.php?start=node_modules/jt-js-sample/index.js - starts a node.js server running the provided index.js file

node.php?stop - stops a running node.js server

node.php?npm=install jt-js-sample - runs npm install jt-js-sample (may be dangerous!)

Demo

Here is a live demo on a dirt cheap PHP shared hosting.

License

Node.js is developed by Joyent et al. under the MIT License.

Node.php is developed by Jerzy Głowacki under the MIT License.

node.php's People

Contributors

akashacoin avatar niutech avatar

Watchers

 avatar  avatar

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.