php lampp permissions of fopen function
Posted
by marmoushismail
on Stack Overflow
See other posts from Stack Overflow
or by marmoushismail
Published on 2010-06-17T13:18:05Z
Indexed on
2010/06/17
13:23 UTC
Read the original article
Hit count: 192
hi i'm programming php using:
- netbeans 6.8
- lampp for ubuntu (xampp)
- apache which came with xampp
$fh = fopen("testfile2.txt", 'w') or die("Failed to create file"); $text ="hello man cool good"; fwrite($fh, $text) or die("Could not write to file"); fclose($fh); echo "File 'testfile.txt' written successfully";
//i get the next error:
Warning: fopen(testfile2.txt) [function.fopen]: failed to open stream: Permission denied in /home/marmoush/allprojects/phpprojects/myindex.php on line 91
Failed to create file
anyway i know what this error is; it's about folder and files permissions; i looked into the folder permission tab made access available for "others" group ( to read and write) the program worked result was a file (test.txt) so i looked at the created file permission it appears to be that (php , xampp or whoever) creates file with (nobody permission)
I have 2 QUESTIONS:
1- what if i need the file created by (php code and xampp ) to have the "root or user or myname" permissions ?? where to set this setting
2-also my concern (what if i send this files to actual web server will it make nobody permissions also nobody ? when they create files
© Stack Overflow or respective owner