Trying to use PHP and NodeJS together to develop an application

50 views
Skip to first unread message

Harishanker V

unread,
Jun 25, 2015, 1:08:56 PM6/25/15
to nod...@googlegroups.com
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.

Guy Duff

unread,
Jun 25, 2015, 2:09:39 PM6/25/15
to nod...@googlegroups.com
don't know if this will help but it is an interesting approach:  http://stackoverflow.com/questions/17209717/how-to-integrate-nodejs-socket-io-and-php

vivek gs

unread,
Jun 25, 2015, 2:09:42 PM6/25/15
to nod...@googlegroups.com

As per my knowledge. We don't need to use both. We can use any one... has both are server side. ...

I am also interesting to hear the thoughts from others.. how can we use both. ...

On 25 Jun 2015 22:38, "Harishanker V" <harish...@gmail.com> 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.

--
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 nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/ee82d882-b7f3-46c0-a4eb-381a625db7da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kevin Ingwersen (Ingwie Phoenix)

unread,
Jun 25, 2015, 2:09:54 PM6/25/15
to nod...@googlegroups.com
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.com/hprose ) and Workerman ( https://github.com/walkor/Workerman ). The idea is to start off a workerman server using a bride ( 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 . The site is made in Yii, but served through Express. To look into the code, 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! :)
Reply all
Reply to author
Forward
0 new messages