Reputation: 4007
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 shell_exec()
function will help. I tried like this
shell_exec('http://172.18.18.219/hrms_work/web/uplodedfiles/test/code4goal-resume-parser/app.js');
but it dose not work.
Upvotes: 1
Views: 6059
Reputation: 48
shell_exec()
argument is wrong. Does this argument work in your terminal? Probably not because is a simple link.app.js
have the correct permissions to run Apache user?After answering these questions, make sure you enter the correct argument in shell_exec()
: absolute path to app.js
and the same command you use in terminal I think is node app.js
.
something like
shell_exec(node /absolute/path/to/app.js);
please let us know ;)
Upvotes: 3
Reputation: 13662
You're not executing any command, that's why it doesn't work. shell_exec()
take exactly what you'd write in a terminal so this should work better shell_exec('node app.js')
. But you will also have to cd
to the right directory or provide an absolute path to app.js
. You're using an url to app.js
, I'm not sure node
can run a remote file like that.
Upvotes: 4