|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
ExecCGI and AddHandler
ok , I have a subroutine in a perl script written like this which opens a file, and writes to it and also creates it if it doesnt exist:
sub write_employment{ my $string = "hello"; open (thefile, "> yayo.txt"); print thefile $string; close (thefile); } now, this is taking place right inside the cgi-bin folder, I also tried it like this: sub write_employment{ my $string = "hello"; open (thefile, "> /directory/to/html/folder/yayo.txt"); print thefile $string; close (thefile); } neither of these is working right now after I have uncommented AddHandler cgi-script .cgi in the httpd.conf and added ExecCGI to my options for the root document declaration (<directory>...</directory>) Do I have to do something else to allow cgi scripts to write files outside of the cgi-bin directory? Any suggestions would be appreciated...thanks!
__________________
Dave |
|
#2
|
|||
|
|||
|
>> Do I have to do something else to allow cgi scripts to write files outside of the cgi-bin directory?
Your case has nothing to do with Apache but setting appropriate permission. I assume your Apache is running as nobody. So this path -> /directory/to/html must have 755 permission, including /directory, /directory/to and /directory/to/html. 755 by all means is searchable but not writable. That said, /directory/to/html/folder needs to chmod 777 (writable) or preferably 757. With this permission, you can create yayo.txt within it, but you can't modify yaya.txt. You need to chmod 646 yaya.txt (666 works too). If yaya.txt is generated dynamically (so you can't chmod 646 prior to its creation), then: sub write_employment{ my $string = "hello"; open (thefile, "> /directory/to/html/folder/yayo.txt"); print thefile $string; close (thefile); chmod 0646 "/directory/to/html/folder/yayo.txt"; } Another thing, if your cgi-bin directory is ScriptAlias'ed, you don't need to set it ExecCGI. You appears to allow cgi execution from anywhere, so setting ExecCGI at the top level <Directory> is fine, it's just a bit insecure, that is all. BTW, please don't cross-post again. If you believed it fits better in Perl forum, which I think it is, post it there. If you don't get a reply in reasonable time, re-post it here, but don't post same message to multiple forums simultaneously. Last edited by freebsd : June 8th, 2001 at 07:37 PM. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > ExecCGI and AddHandler |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|