niutech / node.php

Run node.js apps from PHP even on a shared hosting!
813 stars 236 forks source link

C++ error while loading my server #3

Closed nelson777 closed 8 years ago

nelson777 commented 9 years ago

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 ?

niutech commented 8 years ago

Node.js installed by node.php is 32-bit and your system is 64-bit. You need to install an additional 32-bit library: sudo apt-get install lib32stdc++6