I have a NODE.JS Script which i can start manual at the Console with
cd /home/desktop/www/www.domain.com/bot/;
node bot.js;
But when i want to do this with PHP EXEC it dont work - i tried over 2 days now with all solution on google but nothing helps.
$output = exec("cd /home/desktop/www/www.domain.com/bot/; node bot.js;");
print_r($output);
Output is always 1. There is also no error log or error message - nothing.
Regards
Thomas
CodePudding user response:
Try to give a complete path. Make sure that the file path is correct.
$output = exec("node /home/desktop/www/www.domain.com/bot/bot.js;");
print_r($output);
CodePudding user response:
PHP exec in windows uses CMD.exe by default. So any command must observe cmd syntax.
exec("cd /home/desktop/www/www.domain.com/bot/; node bot.js;");
to
exec("cd /home/desktop/www/www.domain.com/bot && node bot.js;");
Sure, assuming that node
is available on the path