The best way to do this is to create a named pipe.  Check out http://www.kernel.org/doc/man-pages/online/pages/man2/pipe.2.html.  It creates two file descriptors (fd[1] for input and fd[2] for output).

Once you've created the pipe, you can use fdopen to then create a file and attach it to that one of each of the pipes.  For example, you can attach the file cfileinput to fd[1] and cfileoutput to fd[2].

Then, if you open the cfileinput file from php and write to it, and everything you write to the file will be sent to your c program.  You can also open the cfileoutput in php and read output from the c program.

Hope this helps.

John O'Connor
RAD Software Systems

About us:
We're RAD Software Systems, a software development and engineering firm that specializes in Rapid Application Development.  Our team of software engineers uses state of the art agile methods, ensuring our clients deliver on time and on budget.
On my Gumstix Overo I am trying to create a Webpage as the GUI for a C program continuously running on it.

So far I have the Cherokee Webserver installed along with PHP. I've verified that I can put a php file into the website directory and it can be interpreted with the html results displayed on the browser.

Now I have to find some way to communicate between the webpage and a C program.

As a simple test I just want a button on the website that says "GO" and clicking on that will tell a C program to  do something (change GPIO pin state, take an image with a UVC camera, etc).  After that I'll add functionality like being able to read from temperature sensors, etc. The C program needs to run continuously without regard to whether the someone is at the website. The website is just to modify its behavior.

What's the easiest way to communicate via webpage and a C program?

Pipes? Using a file?

Should I even being using PHP to do this or some other scripting language?