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