I'm running an apache server on lubuntu, and am trying to use php to write a text file that the users can then download. I changed the permissions as so:
sudo chmod 775 /var/www -R
But I still get an error when I execute the script:
Warning: fopen(3): failed to open stream: Permission denied in /var/www/myPage.php on line 217 Could not open file!
Here is the php code:
$filename = $liste[0][0];
$fh = fopen($filename, "x+") or die("Could not open file!");
fwrite($fh, "foo") or die("Could not write to file");
fclose($fh);
Do I need to change other permissions? Or is there another way to do what I'm trying to do? Thanks