Permissions issue on opening a file - Perl, CGI
<p>I've been trying to create a log file for an application, using Perl and CGI in an Apache server. For this reason the script needs to keep a log file, which must be opened when the script starts. From the logs I get: <code>Unable to open the file: Permission denied at /usr/lib/cgi-bin/generate_logs.cgi</code>, and the script goes as follows:</p>

<pre><code>#!/usr/bin/perl
use CGI qw(:standard);
print "Content-type: text/plain\n\n";
...
open (my $logs, "&gt;", "/path/to/directory/logs.txt") || die "Unable to open the file: $!";
...
</code></pre>

<p>I've been trying to use non-root paths for the <code>.txt</code> log file, like <code>~/Desktop</code>, but still the script can't create/open log the file. Don't hesitate to ask me if you need more information. Thanks in advance</p>