[Sussex] Welcome to Newbies

Gareth ABLETT garethablett at phpw.fsnet.co.uk
Fri Mar 7 20:57:01 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>";
>
> ?>

I know a couple of other ways to run command line stuff but the
server that the site is on has a ew of these type settings
removed from the php.ini's settings,
I will have a play with things this weekend though.

ps. also if i look at the what steve did, i can convert it to php as
they are similar in style it cant be hard.

Gareth Ablett





More information about the Sussex mailing list