Re: need help on system()
| From: | Marc van Duivenvoorde | Date: | Wed, 11 Jul 2001 12:11:54 +0000 |
| Subject: | Re: need help on system() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-57356@lists.php.net to get a copy of this message | ||
hhhm, I played around a little and found another solution which you might find usefull
<?
exec("/bin/ls -al /home/marcd",$ls);
Array($ls);
$max = sizeof($ls);
$num = 0;
while ($num <= $max)
{
echo $quota[$num],"<br>\n";
$num++;
}
?>
This way you can execute any command and put the output to an array, in the while loop you can print any line in the array.
Marc van Duivenvoorde
At 01:38 PM 7/11/2001 +0200, Marc van Duivenvoorde wrote:
I would do it this way . <? $quota =/usr/bin/sudo /usr/bin/quota -v test;// please mind that the command is between backtics and not quotesecho $quota;// It probably doesn't produce a nice looking output but you can change that yourself // This doesn't work when you have safe mode on in your php.ini file, because then // it doesn't allow commands to be run within backtics.?> Marc van Duivenvoorde At 04:21 PM 7/11/2001 +0800, you wrote:I run the php script as following: <?php //test.php-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.netsystem("/usr/bin/sudo /usr/bin/quota -v test")?> php < test.php - I can get the output in the browser: http://localhost/test.php - I cannot see any output However, <?phpsystem("finger");?> I can both get the output in the console and browser. Does anybody know the reasons? Thank you very much! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net