niutech / node.php Goto Github PK
View Code? Open in Web Editor NEWRun node.js apps from PHP even on a shared hosting!
Run node.js apps from PHP even on a shared hosting!
It does not work with facebook's messenger API
I got the following error while starting my server
node/bin/node: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
but when I tryied to run it again it it said it's already running. So I tryied to start the application on
mydomain.com:8888 and I got
Your connection to this server has been blocked in this server's firewall.
You need to contact the server owner for further information.
Your blocked IP address is 177.158.164.97
so I thought it was the port I used (8888) and see that you use port 49999. So I tried 88888 the request just goes on waiting for an answer and never returns. I thinks this is due to the first block.
The program I'm trying to run is very simple (I'm still learning node.js), this one:
var http = require('http');
var url = require('url');
var server = http.createServer(function (req, res) {
var postData = url.parse(req.url, true);
var result;
var mdate = moment(postData.query['iso']);
switch (postData.pathname) {
case '/host':
result = "host: " + req.headers.host;
break;
}
if (result) {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(result);
} else {
res.writeHead(404);
res.end();
}
}).listen(8888)
I uploaded this file (server.js) to my domain's root. The same dir I installed node.php. And tryied to run it with http://mybuyinglist.com/node.php?start=server.js
I tryed ports 8080 and 9090 with similar results.
Am I doing something wrong ? I find it strange that node.php can run on a high port and mine was blocked.
Edit:
I did some more tests and I'm confident node.php is correctly directing to my file because I add this code to node_start function:
if(file_exists($file)) {
echo "$file exists.\n";
$strfile = file_get_contents($file);
echo $strfile . "\n";
} else {
echo "$file doesn't exists.\n";
return;
}
and it correctly dumped my file. So I guess this server doesn't allow node to run, or is there anything else I can do ?
Hi there,
I´ve try your code and is it amazing. And I've create a test with mysql and every think is fine until I try to get the req. from query .
i.e : http://api.cysub.com/user?name=name&email=email
and you can get the ?name=name&email=email with req.query and it will show somethink like this
{ name: 'name', email: 'email' } with ( console.log(req.query)
but is doen't.
PS / On my test site you can see the last one "test":[] this should print "test":[{ name: 'name', email: 'email' }] if is work.
I´ve creat a control for this node.php like a terminal. You can see its here http://api.cysub.com/?a=setup type help to see the command's.
The terminal css you can get is here from Marcus Bizal.
http://codepen.io/marcbizal/pen/VLKoam
I'm getting this error message when running node.php?start
. Any way I can fix this? Thanks!
Starting: node ''
Warning: exec() has been disabled for security reasons in /home/{mysite}/www/node.php on line 70
Failed.
Warning: file_get_contents(nodeout): failed to open stream: No such file or directory in /home/{mysite}/www/node.php on line 74
Powered by node.php
Hi, thank you for that script! Unfortunately I cannot install packages as described:
Running: node/bin/npm --cache ./.npm -- install jt-js-sample
Failed. Error: 127. See npm-debug.log
All files have chmod 0777. Shared space at All-Inkl.com
Any hint how to proceed?
Hi niutech,
I really love this script. Its working great for node apps, but doesnt seem to be connecting properly for socket.io connections
I've tried implementing even the most basic demo from http://socket.io/demos/chat/ but I cant seem to get it to connect.
Maybe I am missing something. Have you successfully run a socket.io demo on your node.php installation?
Many thanks for a great script! Would be awesome to have the powerful socket.io module working :-)
how do i fix this
Node.php
Starting: node
Failed.
Powered by node.php
Hi, I have a simple php security template I've been using methodologically for 20 years to secure my 'dirt-cheap' PHP shared hosting websites. click here And I want to add node.php as an addon in the application folder. Is that ok with you?
The demo link in the readme has the same problem as I have on my server. I can install and start the server but when I set the node.php?path=xxx it tells me the following error:
Error requesting xxx: couldn't connect to host.
How to solve this error?
Is it a legal process?
how to use socket.io in node.js? how to transfer data from client to node socket.io server or from node socket.io server to client?
I create socket.io server in node.js but can't connect it from client. I use node.php address for socket.io server in client code
Seems like my host disabled it. Can I still get this running?
I tried it. I got this Running: node/bin/npm --cache ./.npm -- install mongodb
Failed. Error: 127. See npm-debug.log
also no log has been created.
This is a bit of a design discussion, but I feel that the location for the node install should be above the public_html/html folder that node.php resides in, that way it is not as easy to discover on the Internet. Obviously, this MAY not be possible on all shared hosting services, but on the couple I've used it would be.
I suggest move the default install location to ../ and just use public_html/node as a fall-back.
hi
after install this error shows , what should i do?
`
Node.php
Downloading Node.js from http://nodejs.org/dist/v9.1.0/node-v9.1.0-linux-x64.tar.gz:
Done.
Installing Node.js:
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Failed. Error: 2
Try putting node folder via (S)FTP, so that /home/hadimtx228/domains/bazfi.ir/public_html/node/bin/node exists.
`
Not sure how I came across this project, but there are probably better approaches out there that are also affordable. An approach like this is subject to many less-than-ideal solutions, along with opening up some pretty big security holes. You're likely better off cutting out PHP entirely and just sticking with NodeJS on its own.
There are a few services out there that can host NodeJS projects affordably, including Heroku. They've also got a great getting started article with NodeJS: https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction
Hope this helps!
Hello,
Getting this for all requests in non-admin mode:
Error requesting : Failed to connect to 127.0.0.1 port 49999: Connection refused
Tried opening port with CSF without any luck.
Any specific ideas?
Thanks
Hi,
Great implementation. Love it. I wanted to know if you have any insight on how to handle this situation and if it is possible. In my url for redirect I keep getting '&redirect_uri=https://mydomain/node.php?path:5000/auth'
On my oauth provider level it will not redirect just keeps getting stuck.
Hi there!
Getting an issue when trying to npm install.
First of all I had to manually unpack node, it now says that install succeeded.
But now I am getting:
Running:
Failed. Error: -1. See npm-debug.log
npm-debug.log returns a 404 page
Add a updated list of compatible hosting providers to the README.md could be very good, don't you think so?
I tried to install nodejs on xampp for testing it. After I'am using http://localhost/Nodejs/node.php?install its look like not installed because 'tar' is not recognized as an internal or external command. What should I do?
would this still work today for godaddy.com's shared hosting plan?
https://ziscom.in/projects/api/nodejs/node.php?install
How to Switch to Admin Mode?
When I am trying to run node.php?npm=install jt-js-sample
Then it is return Failed. Error: 4. See npm-debug.log
I want to install express, socket.io, and mysql via NPM.
How can I did?
live demo is not working
When running the script at a site on a shared hosting (like 000webhost.com) the warning is shown
Warning: set_time_limit() has been disabled for security reasons
and nothing is installed:
Node.php
Node.js is not yet installed. Switch to Admin Mode and Install it.
Powered by node.php
I guess, it's not possible to install node.js on a free (usually restricted) shared hosting ... or do I miss some workaround?
I am trying to run
/node.php?install
But it is saying me to switch to admin mode. How can i switch to admin mode??
Error::
Node.php
Node.js is not yet installed. Switch to Admin Mode and Install it.
Powered by node.php
Hi, thanks for a great project. I would like to try etherpad-lite so I ran this php on my localhost.
However I can't seem to get past
http://localhost/..../test/node.php?path=node_modules\ep_etherpad-lite\node\server.js
Error requesting node_modules\ep_etherpad-lite\node\server.js: Failed to connect to 127.0.0.1 port 9001: Connection refused
neither with the default 49999 nor with 9001 as portnumber which I believe is requested by etherpad.
What am I missing?
Thanks
Node.js is not yet installed. Switch to Admin Mode and Install it
Got the following messages:
Installing Node.js:
Failed. Error:
Try putting node folder via (S)FTP, so that >/home/users/htdocs/node/bin/node exists.
What could be the reason? Thanks.
i want to run
server.js file on port 3001
and
server-test.js on post 3000
Please help me if it is possible ?
Hello
I am They try to run phantomjs with casperjs on my shared hosting but I'm having some problems.
keeps giving me this error
`Starting: node 'node_modules/casperjs'
Done. PID=572210
module.js:341
throw err;
^
Error: Cannot find module '/xxxxx/xxxxx/public_html/node_modules/casperjs'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:141:18)
at node.js:933:3`
Can you help me out? I do not understand how to run the scripts.
I am trying to run npm install on my server and it returns:
Node.php
Running: npm node/bin/npm express
Failed. Error: 126
I was trying to install express. Check out my error here: scratchyone.com/runnode/index.php?npm=express
My node js server setup with node-php stop working after few days. I got a success message
Starting: node 'myapp/server.js'
Done. PID=...
while calling http://myserver/node.php?start=myapp
And my server was working properly.
But after few days it started to show an error message
Error: Failed to connect to 127.0.0.1 port 24572: Connection refused
Then I tried to start the node app again but got this message
Node.js is already running. Stop it.
While trying to stop it, got a messge
Stopping Node.js with PID=:
Error = 1.
Hi, what is the status of this project? Is it still actively maintained?
I have installed node successfully but I am having issues installing express.
When I try node.php?npm=install+express
I get this error:
Error requesting : Failed to connect to 127.0.0.1 port 49999: Connection refused
Can I use Node.php to install express or am I just running in circles?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.