Here's a little tricky part... you can use a named pipe to intercommunicate between php and your c program.
you create a named pipe with the command:
'mknod prog_pipe p'
this will create a NULL byte filename named 'prog_pipe'.
Then by ways of reading or writing to this file you can communicate with eachother..
shared memory can also be used but is a lot trickier and php has to be recompiled to enable it...