On Tue, 1 Feb 2000, Dr. Ashley T. Howes PhD wrote:
I was wondering if you could help on the following problem. I'm developing some cgi scripts using perl on RedHat Linux 6, with the default apache installation. Everything goes ok with the scripts until I need them to write contents to a file. At this point however the file is not created. My guess is that this has something to do with file permissions, because when I run the scripts via the command line, the file is written ok. Furthermore whenever I need to edit my perl scripts in /home/httpd/cgi-bin/... I need to go into superuser mode in order to save changes.
Ah, big clue there...
What permissions do I need to set on the scripts and directory containing them in order for the scripts to create and write to files? Do I need to chmod anything or chown particular files, e.g. something like 'chown www script.pl'? Or is the problem in the default apache configuration which comes with Redhat 6. I have already chmoded the scripts so they have read, write and execute permissions.
That rather depends on what you want executing them. PERL AFAIK will execute things using the ownership/group permissions of whatever ran the PERL script itself, be that your or, say, the webserver.
If the thing running the PERL script (i.e. you) doesn't have permission to create a file in the directory, then neither will PERL.
If the PERL script is being run by the webserver when you're having problems, then make sure the webserver is running in the right user/group (in httpd.conf this can be set), a better way though is just to modify the target directory to allow write access from nobody.nobody (or whatever user.group your webserver runs as).
I *hope* I've read your message right :)
James Green
[ This email came to you via the Anglian Linux User Group list ] [ If you only wish to recieve event announcements, email the ] [ SUBJECTs of "unsubscribe alug" and "subscribe alug-announce" ] [ to listserver@stu.uea.ac.uk -- We do need your support, tho' ]