I’m trying to open a file with PHP for write access:
$myFile = "all.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
My browser is spitting back:
can’t open file
I’ve tried to chmod -R 777 the folder where this PHP file is as well as where $myFile (a text file) sits. What else could be the problem?
It ends up being that there are permission errors when I turn error reporting on. When I do ls -la all.txt, I get -rwx------ 1 Myname staff 0 Nov 8 15:11 all.txt
If the script is started from other directory, please try open file from the full URI.
Example: