Connecting Tech Pros Worldwide Help | Site Map

execute perl CGI from PHP

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 16th, 2005, 10:48 PM
w i l l
Guest
 
Posts: n/a
Default execute perl CGI from PHP

I am trying to execute a perl CGI from within a PHP script. I have
tried the following notation without success.

<?php include("http://" . $_SERVER['SERVER_NAME'] .
"/somedir/afile.cgi"); ?>

The CGI works on it's own without problems. Is this a limitation of
PHP?

Thanks,
w i l l


  #2  
Old July 16th, 2005, 10:49 PM
Luke Ross
Guest
 
Posts: n/a
Default Re: execute perl CGI from PHP

Hi,

w i l l wrote:[color=blue]
> I am trying to execute a perl CGI from within a PHP script. I have
> tried the following notation without success.
>
> <?php include("http://" . $_SERVER['SERVER_NAME'] .
> "/somedir/afile.cgi"); ?>
>
> The CGI works on it's own without problems. Is this a limitation of
> PHP?[/color]

include() brings in another PHP file rather than requesting another page.

Under Apache you can use virtual("/somedir/afile.cgi"); to execute a
subrequest.

If you're not using Apache, but have URL wrapper turned on, you can use:
$fd = fopen("http://" . $_SERVER['SERVER_NAME'] . "/somedir/afile.cgi",
"r");
fpassthru($fd);

Or as someone else has suggested, you could run it directly using the
system execution functions if the script is on the same machine.

Regards,

Luke

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.