[PHP] Newbie: Reading unix directory information from PHP

2002-07-23 Thread Paul Oh

Hi, I'm just starting to learn PHP.  I couldn't find how to execute unix
command and read the result.  Basically, I just want to execute ls -lrt
and read and display the output.

This may be very simple question, but for some reason, I couldn't find any
info on executing unix command from PHP.

Thanks.

-Paul



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Newbie: Reading unix directory information from PHP

2002-07-23 Thread Jason Soza

Maybe opendir() and readdir() would work for you?

opendir():
http://www.php.net/manual/en/function.opendir.php

readdir():
http://www.php.net/manual/en/function.readdir.php

Jason Soza

- Original Message -
From: Paul Oh [EMAIL PROTECTED]
Date: Tuesday, July 23, 2002 3:03 pm
Subject: [PHP] Newbie: Reading unix directory information from PHP

 Hi, I'm just starting to learn PHP.  I couldn't find how to 
 execute unix
 command and read the result.  Basically, I just want to execute 
 ls -lrt
 and read and display the output.
 
 This may be very simple question, but for some reason, I couldn't 
 find any
 info on executing unix command from PHP.
 
 Thanks.
 
 -Paul
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Newbie: Reading unix directory information from PHP

2002-07-23 Thread Peter

Hi Paul,

this should help you out

?php
$LastLine = exec(ls -lrt, $AllOutput, $ReturnValue);

print(Last Line: $LastLine BR\n);

print(All Output:BR\n);
for ($index = 0; $index  count($AllOutput); $index++)
{
print($AllOutput[$index] BR\n);
}
print(BRBR\n);
print(Return Value: $ReturnValueBR\n);
?

should work a treat for you ...

cheers
Peter

 -Original Message-
 From: Paul Oh [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 24 July 2002 9:04 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Newbie: Reading unix directory information from PHP


 Hi, I'm just starting to learn PHP.  I couldn't find how to execute unix
 command and read the result.  Basically, I just want to execute ls -lrt
 and read and display the output.

 This may be very simple question, but for some reason, I couldn't find any
 info on executing unix command from PHP.

 Thanks.

 -Paul



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Newbie: Reading unix directory information from PHP

2002-07-23 Thread Peter

on this you may want to have a look in the manual for exec(), the command I
used in my example, or system() they both let you run applications on your
server such as 'ls' and the like.

 -Original Message-
 From: Peter [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 24 July 2002 9:23 AM
 To: Paul Oh; [EMAIL PROTECTED]
 Subject: RE: [PHP] Newbie: Reading unix directory information from PHP


 Hi Paul,

 this should help you out

 ?php
 $LastLine = exec(ls -lrt, $AllOutput, $ReturnValue);

 print(Last Line: $LastLine BR\n);

 print(All Output:BR\n);
 for ($index = 0; $index  count($AllOutput); $index++)
 {
   print($AllOutput[$index] BR\n);
 }
 print(BRBR\n);
 print(Return Value: $ReturnValueBR\n);
 ?

 should work a treat for you ...

 cheers
 Peter

  -Original Message-
  From: Paul Oh [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, 24 July 2002 9:04 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Newbie: Reading unix directory information from PHP
 
 
  Hi, I'm just starting to learn PHP.  I couldn't find how to execute unix
  command and read the result.  Basically, I just want to execute
 ls -lrt
  and read and display the output.
 
  This may be very simple question, but for some reason, I
 couldn't find any
  info on executing unix command from PHP.
 
  Thanks.
 
  -Paul
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php