Executing a CGI scripts

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
PingLeeQuan
Forum Commoner
Posts: 58
Joined: Tue Sep 03, 2002 8:08 am

Executing a CGI scripts

Post by PingLeeQuan »

I am converting some code from .SHTML to PHP. In SHTML, we can use the following statent to execute a cgi script that resodes om cgi-bin.


<!--#exec cgi="./cgi-bin/banner.cgi" --><!--#exec cgi="./cgi-bin/random.cgi" -->

how can i call the same script using php. I used
<? include "./cgi-bin/banner.cgi";
include "./cgi-bin/random.cgi";
?>

But with no luck
amy sugestions?
thanks
--Quan
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

I think you'll want to look into system() or less likely exec()

Eric
PingLeeQuan
Forum Commoner
Posts: 58
Joined: Tue Sep 03, 2002 8:08 am

Post by PingLeeQuan »

thanks for your reply... i tried both "system()" and "exec()" but none worked. I also tried passthru() but no luck... the random image is not being displaied and no errors either. I must be doing somthing wrong but i cannot figure it out.

this is what i did

$y="#exec cgi='./cgi-bin/random.cgi'";
passthru ($y);
Post Reply