×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Hello,
Not clear why you'd want to "attach" the php-cli to Node.js -- this is a
weird question. But, if for some reason you really want to run php
scripts from within node (maybe you've got some utility you wrote in PHP
that you'd like to call from Node? I guess?) it's very easy to do.
The Node.js child process module has a spawn() routine. This can be
used to run other things in the PASE environment very easily and pipe
the output back to your program (if desired).
For example:
"use strict";
const spawn=require('child_process').spawn;
let php = spawn('/usr/local/zendsvr6/bin/php-cli', ['test.php']);
php.stdout.pipe(process.stdout);
so, I can call any PASE program with spawn() like this. (the second
argument is an array of parameters to pass to the program. In this case,
the program is php-cli, and the parameter is the PHP script to run)
php.stdout.pipe(process.stdout) connects the output of the PHP script
with the output of my Node.js script so that it will simply print on the
display.
More detail on child processes in Node.js can be found here:
http://nodejs.org/api/child_process.html
So, I don't understand WHY you want to do this, but I know HOW to do
it... it's really easy.
On 2/26/2015 4:46 PM, Gqcy wrote:
is this a thing?
I have only about 1 hour of reading about node.js, and see that
it runs in it's own web server, so how would you "attach" the php-cli
to it?
As an Amazon Associate we earn from qualifying purchases.