[Sussex] Welcome to Newbies
Paul Turner
pturner at rentokil.com
Fri Mar 7 10:23:02 UTC 2003
Gareth,
There are four ways (that I know of) to integrate a command line program in
to php. There are subtle differences between them, but for returning text
out (I believe thats all you need) any of them should work.
Try this, I hope it helps you.
<?
echo "<pre>";
// exec version
exec("ls -la", $result);
foreach ($result as $line)
echo "$line\n";
echo "<br><hr><br>";
// passthru version
passthru("ls -la");
echo "<br><hr><br>";
// system version
$result = system("ls -la");
echo "<br><hr><br>";
// backticks version
$result = `ls -la`;
echo $result;
echo "</pre>";
?>
Regards Paul.
----- Original Message -----
From: "Steve Dobson" <SDobson at manh.com>
To: <sussex at mailman.lug.org.uk>
Sent: Friday, March 07, 2003 9:53 AM
Subject: RE: [Sussex] Welcome to Newbies
> Gareth
>
> On 06 March 2002 at 20:41 Gareth ABLETT wrote:
> ^^^^
> Check you're system time mate - or have to travelled back in time
> with yesterday's e-mails?
>
>
> > Folowing that well you wrote a program in C and well to do
> > anything like intergrating that into the site is more hard work
> > so i'm not sure of what i need to do will have to look into it.
>
> All you should need to do is locate the binary in a path that is
> configured to be available to apache and it's sub-processes. Then
> call in from the php file (which I haven't a clue about). I've
> done this sort of thing with SSI.
>
> Steve
>
> _______________________________________________
> Sussex mailing list
> Sussex at mailman.lug.org.uk
> http://mailman.lug.org.uk/mailman/listinfo/sussex
>
> _____________________________________________________________________
> This message has been checked for all known viruses by
> MessageLabs on behalf of Rentokil Initial plc
>
_____________________________________________________________________
This message has been checked for all known viruses by
MessageLabs on behalf of Rentokil Initial plc
More information about the Sussex
mailing list