FutureQuest, Inc. FutureQuest, Inc. FutureQuest, Inc.

FutureQuest, Inc.
Go Back   FutureQuest Community > General Site Owner Support (All may read/respond) > PHP, Perl, Python and/or MySQL
User Name
Password  Lost PW

Reply
 
Thread Tools Search this Thread Display Modes
Old 12-09-1999, 03:42 PM   Postid: 43380
jbroder
Site Owner

Forum Notability:
10 pts: User-friendly
[Post Feedback]
 
Join Date: Dec 1998
Location: oakland, ca, usa
Posts: 138
PHP array

I am new to PHP, so here is a simple question.

I found the safe mode ls command in an earlier posting.
When I try to access it on the command line, it works
great. When I put it into a php script, I only get the
last file. Here is my script:
  $arr_do =  array(exec("/big/dom/PHP_bin/ls -l /big/dom/PHP_bin/ls /big/dom/xgu
itarwar/www&quot) ;

Which returns the name of the last file in the directory in a scalar variable (not a one set array). Clearly, I don't
know how to set up an array. But I am following the instructions in the only PHP book I could find (by David Medinets).

Please help...
jbroder is offline   Reply With Quote
Old 12-09-1999, 04:29 PM   Postid: 43381
 Terra
CTO FutureQuest, Inc.
 
Terra's Avatar
 
Join Date: Jun 1998
Location: Z'ha'dum
Posts: 7,678
There is no need to call 'ls' to get a directory listing...

Just use the internal functions for working with Directories:
http://www.php.net/manual/ref.dir.php3



--
Terra
sysAdmin
FutureQuest
Terra is offline   Reply With Quote
Old 12-09-1999, 04:34 PM   Postid: 43382
jbroder
Site Owner

Forum Notability:
10 pts: User-friendly
[Post Feedback]
 
Join Date: Dec 1998
Location: oakland, ca, usa
Posts: 138
Thanks!

jbroder is offline   Reply With Quote
Old 12-09-1999, 05:56 PM   Postid: 43383
Justin
Visitor
 
Justin's Avatar

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Jan 1999
Location: Kissimmee, FL
Posts: 3,672
On a side note - any of PHP's exec(), system(), and similar functions will in fact only return the last line - I have not found a way to get actual output from any command line function from PHP. In the manual it mentions that it will always return just the last line so you can check for success/failure.

This is why they provide so many internal functions - PHP can handle a good deal of things you might normally need a command line to do - but when you do run into one you need (whois, for example) it is a royal pain...

------------------
Justin Nelson
FutureQuest Support
Justin is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 visitors)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 12:38 PM.


Running on vBulletin®
Copyright © 2000 - 2013, Jelsoft Enterprises Ltd.
Hosted & Administrated by FutureQuest, Inc.
Images & content copyright © 1998-2013 FutureQuest, Inc.
FutureQuest, Inc.