Newbie problem writing to a file...
Posted: Thu Mar 31, 2011 8:38 pm
Newbie here... Thanks for your help.
I am using the "How to do everything in PHP & MySQL" book. I am learning how to write to a file. I am having problems noted below...
For this php code...
I am getting this returned...
Warning: fopen(WriteTest.txt) [function.fopen]: failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/ReadWriteFileExample.php on line 5
What the hell, this did not work at all.
I have ensured that the htdocs folder has read write access. I'm not sure what I am doing wrong.
Any ideas? Thanks in advance, BtD
I am using the "How to do everything in PHP & MySQL" book. I am learning how to write to a file. I am having problems noted below...
For this php code...
Code: Select all
<?php>
$file = 'WriteTest.txt';
$fh = fopen($file, 'w') or die('What the hell, this did not work at all.');
fwrite($fh, 'We will see if this really works.') or die('Could not write to file.');
fclose($fh);
?>Warning: fopen(WriteTest.txt) [function.fopen]: failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/ReadWriteFileExample.php on line 5
What the hell, this did not work at all.
I have ensured that the htdocs folder has read write access. I'm not sure what I am doing wrong.
Any ideas? Thanks in advance, BtD