ugasucks,
this worked for me so you may want to try it:
<?php
$fp = fopen("try.txt", "w");
if (!$fp){ echo "it didn't work."; }
//attempt to write the output to file
fputs($fp, system("ls -al | head -2 "));
fclose($fp);
?>
verification on working🙁my system anyways ;-P)
[root@fireleg justin]# more try.txt
drwxr-xrwx 6 root root 4096 Feb 20 13:12 .
[root@fireleg justin]# more test.php
<?php
$fp = fopen("try.txt", "w");
if (!$fp){ echo "it didn't work."; }
//attempt to write the output to file
fputs($fp, system("ls -al | head -2 "));
fclose($fp);
?>
[root@fireleg justin]# ls -al | head -2
total 36
drwxr-xrwx 6 root root 4096 Feb 20 13:12 .
[root@fireleg justin]#
I ran the test.php file, then more'd the try.txt file it created, then more the test.php file to verify the syntax then ran it on the command line to make sure it had the same result that the file showed... Hope this helps...
-=[Juztin]=- 😉