PHP and Socket.io

Hi All…

I am building a Web based user interface to manipulate how a PRU program functions on a BeagleBone Black. The PRU is affected by variables adjusted using C programs and data can be taken back out in the same manner. I am partly there, in that I can start the C programs from a web page using PHP commands (actually via .sh files) . Most of this work is based on examples given by Derek Molloy in Exploring BeagleBone.

I need to augment this with sliders and displays that seem to fit best with socket.io. I have a start to this which seems to work (based on Simon Monks book), however I can’t figure out how to make both PHP and node.js/socket.io work together.

The PHP program works on port 8080. To make the socket.io program a server.js program is started which listens for a different port (in this case 8085 while simultaneously communicating with a C program that is outputting to socket 8086). If I try to listen to 8080 using the node server, that port is indicated as busy. I am assuming this is because PHP is in effect another socket connection, but would be happy to be corrected. If I connect to a PHP file from the browser using port 8085, the PHP portions of the program do not work.

My question is, does anyone know of an example in which PHP and socket.io are used together or can you suggest an alternative way to achieve this?

Thanks in advance,
Alan

Hi Alan!

Why don’t you install a web server like lighttpd and connect your C app to that server by fcgi? Use html features for sliders and displays, or send js-scripts, if need be.

BR