kullanarak ls-lt'ye PHP exec ()

0 Cevap php

as the problem states.. when i do

exec("ls -ltr  > output.txt 2>&1",$result,$status);

normal çıkışından da farklı olabilir. Ekstra bir sütun eklendi alır. gibi bir şey

-rw-r--r-- 1 apache   apache    211 Jul  1 15:52 withoutsudo.txt
-rw-r--r-- 1 apache   apache      0 Jul  1 15:53 withsudo.txt

nerede onun gibi istemi komut çalıştırıldığında olarak

-rw-r--r-- 1 apache   apache    211 2010-07-01 15:52 withoutsudo.txt
-rw-r--r-- 1 apache   apache    274 2010-07-01 15:53 withsudo.txt
-rw-r--r-- 1 apache   apache    346 2010-07-01 15:55 sudominusu.txt
-rw-r--r-- 1 apache   apache    414 2010-07-01 15:58 sudominusu.txt

See the difference. So in the first output , my usual awk '{print $8}' fails. I was facing the same problem with cron. But solved it by calling

./$HOME/.bashrc

Senaryoda. Ama php kullanarak olmuyor. Şekilde olursa ben php zamanki ortamdan için "exec", "söyle" olabilir. Herhangi bir yardım mutluluk duyacağız.

0 Cevap