I'm using Ubuntu 12.04 and Apache2. My perl script is on /usr/lib/cgi-bin
and i'm trying to write a file(open ">") to /var/www/my_custom_dir
but i get:
Permission denied
If i try to write to the script's directory or any other the error is the same. The permissions seem right. Everything is 755, root owner. I tried to change "my_custom_dir" owner to www-data(apache user), but does not make any difference.
open ( UPLOADFILE, ">$filepath" ) or die "$!"; binmode UPLOADFILE;
while ( <$file> ) { print UPLOADFILE $_; } close($file); close UPLOADFILE; }
It "die" on the the first line. The error on log is "Permission denied at /usr/lib/cgi-bin/script.cgi"