+ 1

php fopen()

why i got "warning: fopen(text.txt):failed to open stream: permission denied in/opt/lampp/htdocs/file.php on line 23" ?

14th Jul 2017, 2:37 AM
faruq ah
faruq ah - avatar
4 Answers
+ 2
you have to change the permission of your directory to accessible to you you need to have write permission if you are using linux just run this command on terminal open your local server directory open it with terminal sudo chmod -R 777 (directory name) chmod will change the file mode(permission) 777 will give writing and reading permission for users incase you are using windows just google search how to change file permission in windows then you are free to go hope this will help😉😉
14th Jul 2017, 4:34 AM
Ermyas
Ermyas - avatar
+ 2
ah, thanks @Emyas. it work me 😄. i'm using linux and run chmod like you write 👍
14th Jul 2017, 5:28 AM
faruq ah
faruq ah - avatar
+ 2
Am glade it worked
14th Jul 2017, 6:01 AM
Ermyas
Ermyas - avatar
+ 1
Because your user doesn't have permissions to open that file on your system. It is probably in a location that doesn't allow the user to modify/open files such as in your system files. Copy or move the file(s) to a user accessible location or change the permissions to those file(s) or the directory to allow your user read/write access.
14th Jul 2017, 3:47 AM
ChaoticDawg
ChaoticDawg - avatar