Page 1 of 1

a passthru() question/problem

Posted: Mon Nov 25, 2002 9:29 am
by webguy
hello...i've done some searching through the forums here for related posts on the passthru() function, but I have not found the answer I am seeking. So I figured I'd post about this function again and see if I someone can help out...

Problem: when I use the passthru() function it only returns the last line of the application I am running through it.

my code:
<?php
passthru('../cgi-bin/crnews/crnews.pl');
?>

"passthru -- Execute an external program and display raw output "

Now, if I understand this function correctly, this should execute the perl script and display the raw output of the progam, correct?

Well, it does execute the program, BUT only returns the last line of the output. (I've tried with these as well: exec(), system() and they do not work either. )

Basically, I want to execute a perl script and display the output on a .php page.

Maybe I'm using the wrong function? Or maybe this is just not possible?

Any help would be most appreciated!

Thanks,
webguy

Posted: Wed Nov 27, 2002 10:27 am
by BigE
Hmm... not sure about that one, you might consider using virtual() however. php.net/virtual is similar to Apache's <!--#include virtual...--> which can be done to run Perl scripts. By the way, I noticed your IN Kansas City, MO. I'm in St. Joseph, MO :) PM or message me on IM sometime. Anyway, hope that helps.

Posted: Wed Nov 27, 2002 12:15 pm
by liderbug
Hmmm, works find on my box

------ foo4 via the command line ---------
#!/usr/local/bin/php
<?
passthru ("ls -l");
?>
-------------------------------
and
----------foo4.php via browser ------
<?
passthru ("ls -l");
?>
---------------------

both return a listing of the local dir
Ah, question does your perl script expect any args?
Try the command line version above
Rots'aRuck