Piyush Piyush - 4 months ago 82x
Node.js Question

Run node js from php shell_exec()

Hi I uploded some files to parse which parsed by

node js
. currently I am running it from terminal as
node app.js

I need to call it from my php model.

I am thinking
function will help. I tried like this


but it dose not work.

  1. your shell_exec argument is wrong. This argument works on your terminal? Probably not because is a simple link.
  2. Your file app.js has the correct permissions to run Apache user?

After answering these questions, make sure you enter the correct argument in schell_exec(): absolute path to app.js an the same command you use in terminal I think is node app.js.

something like schell_exec(node /absolute/path/to/app.js);

please let us know ;)