<br><br><div class="gmail_quote">On Wed, May 7, 2008 at 12:38 PM, Mike Wright <<a href="mailto:mike.wright@mailinator.com">mike.wright@mailinator.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">Matthew Benjamin wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Does anyone have any experience with the following error message in PHP running on Linux "*PHP Warning:  fopen(./text.txt): failed to open stream: Permission denied*"?<br>
<br>
I am trying to create a text file on Linux via a website utilizing PHP. I have changed the ownership to apache:apache, and chmod 777 and 755 with no success.<br>
<br>
The meat of the code is as follows<br>
<br>
$myFile = "./text.txt";<br>
$filehandle = fopen($myFile, 'w+') or die("can't open file");<br>
$stringData .= "Hello Tux";<br>
fwrite($filehandle, $stringData);<br>
fclose($filehandle);<br>
</blockquote>
<br></div></div>
Hi, Matthew,<br>
<br>
Two things come to mind:<br>
<br>
1) $myFile should contain the full path<br>
2) the directory that will contain text.txt must be writeable by apache<br>
<br>
hth, :m)<br><font color="#888888">
<br>
-- <br></font><div><div></div><div class="Wj3C7c">
fedora-list mailing list<br>
<a href="mailto:fedora-list@redhat.com" target="_blank">fedora-list@redhat.com</a><br>
To unsubscribe: <a href="https://www.redhat.com/mailman/listinfo/fedora-list" target="_blank">https://www.redhat.com/mailman/listinfo/fedora-list</a><br>
</div></div></blockquote></div><br>Still not working. I have checked my PHP config and it is all good.<br clear="all"><br>-- <br>mB.