PHP Warning: Failed to open stream: Permission Denied

Matthew Benjamin msbenjamin12 at gmail.com
Wed May 7 19:03:29 UTC 2008


On Wed, May 7, 2008 at 12:38 PM, Mike Wright <mike.wright at mailinator.com>
wrote:

> Matthew Benjamin wrote:
>
> > 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*"?
> >
> > 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.
> >
> > The meat of the code is as follows
> >
> > $myFile = "./text.txt";
> > $filehandle = fopen($myFile, 'w+') or die("can't open file");
> > $stringData .= "Hello Tux";
> > fwrite($filehandle, $stringData);
> > fclose($filehandle);
> >
>
> Hi, Matthew,
>
> Two things come to mind:
>
> 1) $myFile should contain the full path
> 2) the directory that will contain text.txt must be writeable by apache
>
> hth, :m)
>
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>

Still not working. I have checked my PHP config and it is all good.

-- 
mB.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20080507/76a067ec/attachment-0001.htm>


More information about the fedora-list mailing list