I had the same question. I tried calling php through the shell interface and it gave the desired result:
var exec = require("child_process").exec; app.get('/', function(req, res){exec("php index.php", function (error, stdout, stderr) {res.send(stdout);});});
I am sure that this is not so much on the list of recommended practices, but he seems to have done what I wanted. If, on the other hand, you do not want to execute PHP scripts directly from Node.js, but want to transfer them from another web server that does this, this seems to do the trick:
var exec = require("child_process").exec; app.get('/', function(req, res){exec("wget -q -O - http://localhost/", function (error, stdout, stderr) {res.send(stdout);});});
Dave Causey Oct 12 '11 at 3:26 2011-10-12 03:26
source share