Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fopen permission denied

I am getting the following error when I try loading one of my php pages:

[Fri Apr 08 22:59:50 2011] [error] [client ::1] PHP Warning: fopen(tracking_id.txt): failed to open stream: 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);

Anyone know how this can be resolved?

I am using Ubuntu as the OS, and apache as the webserver.

I used tasksel to install LAMP-server

like image 318
oshirowanen Avatar asked Feb 24 '23 13:02

oshirowanen


1 Answers

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

chmod a+w tracking_id.txt
like image 174
dionyziz Avatar answered Mar 05 '23 16:03

dionyziz