Zend - The PHP Company




External

Add Code


Print output from external program  

Type: code fragment
Added by: ADMIN
Entered: 18/01/2000
Last modified: 08/12/1999
Rating: **** (9 votes)
Views: 10438
this code will run external program (ls -l) and print all the output


<?php
//You may need to provide the full path to ls
//If your web-server user has no environment 'path'
$line1 exec('ls -ls'$output$error);
while (list(,
$line) = each($output)){
  echo 
$line"<BR>n";
}
if (
$error){
  echo 
"Unix error code: $error<BR>n";
  exit;
}


?>


Usage Example




Rate This Script





Search



This Category All Categories