a passthru() question/problem

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
webguy
Forum Newbie
Posts: 7
Joined: Wed Nov 20, 2002 3:53 pm
Location: Kansas City, MO

a passthru() question/problem

Post 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
User avatar
BigE
Site Admin
Posts: 139
Joined: Fri Apr 19, 2002 9:49 am
Location: Missouri, USA
Contact:

Post 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.
liderbug
Forum Newbie
Posts: 19
Joined: Tue Jul 23, 2002 2:18 pm

Post 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
Post Reply