Fopen permission not allowed

When trying to load one of my php pages, the following error occurs:

[Fri Apr 08 22:59:50 2011] [error] [client :: 1] PHP Warning: fopen (tracking_id.txt): stream could not be opened: permission denied in /var/www/basic.php on line 61

Line 61 is the second line from the script below:

$ourFileName = "tracking_id.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fwrite($ourFileHandle, $trackingId); fclose($ourFileHandle); 

Does anyone know how to solve this?

I use Ubuntu as the OS and apache as the web server.

I used tasksel to install the LAMP server

+4
source share
1 answer

Create a file called tracking_id.txt and run the following command on it:

 chmod a+w tracking_id.txt 
+7
source

Source: https://habr.com/ru/post/1347315/


All Articles