I have a PHP script that receives 3 arguments to insert into a database
php app.php "Arg1" "Arg2" "Arg3"
When I run it from console I can do it without any problem, to call it from my node.js script I try with:
var exec = require("child_process").exec;
app.get('/', function(req, res) {
exec("php app.php", function(error, stdout, stderr) {
console.log("ESPERO QUE NO TENGA ERROR: ", error);
if (!error) {
res.send(stdout);
}
});
That code does not do anything, I do not even find a way to send arguments to it. Do you know what is the correct way to run a php script and send the arguments from node.js?