Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old June 8th, 2001, 07:02 PM
dave_mwi dave_mwi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Posts: 93 dave_mwi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 40 m 53 sec
Reputation Power: 8
Send a message via AIM to dave_mwi
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

Reply With Quote
  #2  
Old June 8th, 2001, 07:31 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> 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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > ExecCGI and AddHandler


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway