How to Access C Program from the Server called by PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phpStupid
Forum Newbie
Posts: 1
Joined: Sun Aug 28, 2005 1:38 am

How to Access C Program from the Server called by PHP

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

I think you're talking about CGI applications. The C program will have to output HTML.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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/ ;)
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

use system() to display output from an execution if necessary.
Post Reply