I am using MAMP for Apache localhost server on a mac. I have a php code which adds username and password to the existing accounts.txt file. I have got a code to check if the file accounts.txt is writable and display in localhost if it is not writable, and as the localhost echoes “File is not writable”. Both the php code file and accounts.txt are within the same folder directory. How can I resolve this permission issue?
I have tried to change the permission to htdocs for _www but then I am unable to edit the code in VScode within that. I am writing into the accounts.txt via file_put_contents($filename, $newaccounts, FILE_APPEND). I have tried fwrite() as well but it doesn’t seem to be working resulting in the same writable issue.
Krishna Giri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.