Piyush Piyush - 2 years ago 326
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.

Answer Source
  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 ;)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download