When running a program that writes a file from php, the file becomes empty and is write protected! It is wrong since the file should be filled with data!
I have a program called "rlx" that takes two arguments and writes a file. The command line could be "~/rlx file b" and it executes correctly from shell. What it does is to write a file to webserver/rlx/file.dat.
The permission for the program rlx is 755, the permission for the dir rlx is 777, and the text output from the program after having run it is correct. (It displays the filename and other data).
Also php is set up to work with writing files. It can read and write files in the rlx directory, it just can't make the program rlx write a file with data to rlx directory!
//Commandline tried are all these, just one of them in the real code of course:
$commandline = "/home/me/rlx/rlx file b";
$commandline = "/../../rlx/rlx file b";
// since above didnt work, i tried to copy the program file to the web directory, renaming it to rlx2 so it doesnt have the same name as dir
$commandline = "rlx2 file b";
$commandline = "/.rlx2 file b";
// one of following in the real code of course
exec($commandline);
system($commandline);
shell_exec($commandline);