Page 1 of 1

How to Access C Program from the Server called by PHP

Posted: Sun Aug 28, 2005 1:43 am
by phpStupid
Hi all,

I am a super newbie to PHP and i was told to code a C program and put it into the server. And users are suppose to run it from client browser. This is my undergraduate thesis.

Anyone can help??

Regards

Posted: Sun Aug 28, 2005 8:26 am
by feyd
run it directly, or php is supposed to run it?

running it directly involves sending the file to the client browser in some fashion (typically download.)

running from php involves using one of the execution functions such as exec(), however, if this application is graphical and not command line or at least command line interactive, you will have difficuly getting php to show anything to a client.

Posted: Sun Aug 28, 2005 10:00 am
by Ambush Commander
I think you're talking about CGI applications. The C program will have to output HTML.

Posted: Sun Aug 28, 2005 12:31 pm
by Chris Corbyn
Ambush Commander wrote:I think you're talking about CGI applications. The C program will have to output HTML.
It also needs to be run from the CGI folder on the server to work. It's defined in apache's httpd.conf and is usually {Webroot}/cgi-bin/ ;)

Posted: Sun Aug 28, 2005 12:41 pm
by Joe
use system() to display output from an execution if necessary.