I'm trying to write some command line PHP - is there a trick to writing to a file from the command line using PHP? The file is called testcl.php and I execute it with:
/usr/bin/php -f /var/www/html/media/testcli.php
$myFile = "test.txt";
$fh = fopen($myFile, 'a');
fwrite($fh, "batman2");
fclose($fh);
echo "batman";
The batman echo statement works, so I know the file is running - but it's not writing to test.txt for some reason. If I access testcli.php it writes text.txt successfully - so I think I'm missing some trick.