On Do. Juni 25 2015 18:51:04 Harishanker V wrote:
> I'm trying to develop a web application using PHP and NodeJS (for Server 
> communication) with MySQL database. After some research I found some 
> cross-language services like DNODE and Apache Thirft but with not much 
> success. I do not want to use CURL and SOAP as this would affect my 
> application's performance. Is there anything else that i'm missing? OR is 
> this a right approach ? Thanks for your valuable comments & suggestions.


I wrote myself a system based on hprose ( http://github 
<http://github/>.com/hprose ) and Workerman ( 
https://github.com/walkor/Workerman <https://github.com/walkor/Workerman> ). 
The idea is to start off a workerman server using a bride ( 
https://github.com/hprose/hprose-workerman 
<https://github.com/hprose/hprose-workerman> ) and connecting to it. That way, 
you can run PHP code and return the resulting page to NodeJS.

- Bring up a hprose-workerman server using child_process.spawn and pass 
arguments to that process. For instance:

        child_process.spawn("php", ["myfile.php", JSON.stringify({ port: 5000 
})])

- Grab the parameters in PHP and initialize the server.

        <?php $args = json_decode($argv[1]);

- On client connection, establish a connection to the hprose server and request 
a page (in my case, i just call a remote function. That remote function 
simulates a HTTP request, returns the page and cleans itself up for the nxt 
request.)

I have this working as a live example here http://dev.dragonsinn.tk 
<http://dev.dragonsinn.tk/> . The site is made in Yii, but served through 
Express. To look into the code, http://git.ingwie.me/ingwie/bird3/tree/master 
<http://git.ingwie.me/ingwie/bird3/tree/master> . node-lib is all the NodeJS 
stuff, php-lib is all the PHP stuff. you’re likely interested in 
node-lib/front-end .

Let me know if you have questions! :)

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/5EBBF989-059D-421C-B99F-F0E540A8ADC9%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to