Re: PHP Warning: Failed to open stream: Permission Denied

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux