I have a Node.js file which returns asterisk peer status on html file when I run command node -file name. Is it possible to create a PHP script to run that file on click of button? I tried PHP exec function but it didn't work ! I want that on click of button the script should start to execute and on another button it must stop the execution.
Asked
Active
Viewed 637 times
0
-
Note exactly sure what you mean by "a Node.js file", but you _might_ be fererring to a javascript file. If so you need a javascript interpreter, not a php interpreter. So most likely a node.js server does make sense... You then can query that server (thus the status you are interested in) when clicking on a button in some html page whichmight have been delivered from a php enabled http server. However wouldn't it be easier to write a script querying that status in native php, if you already are using php? – arkascha May 25 '15 at 11:29
-
@arkascha I tried using php to get those status it worked as well, but the issue is i want the information to be real time! Php does the job but doest give real time data.. – Rajan May 26 '15 at 07:54
-
I'd say that is a question of what you coded. Both php and javascript are just pogramming languages. You can implement exactly the same things in both, none is more or less capable. So this sounds more like you did code something else in php, not what you have in javascript. – arkascha May 26 '15 at 08:51
1 Answers
0
Node.js only supports JavaScript. Here is a tutorial on how to have PHP running with Node.js on the side.
http://blog.mixu.net/2011/01/04/nginx-php-fpm-and-node-js-install-on-centos-5-5/
Hope it helps :)

Adarsh Vardhan
- 257
- 3
- 13