Link to home
Start Free TrialLog in
Avatar of SketchySteve
SketchySteve

asked on

Allowing a CGI script to create and write to a directory

Hi,

I'm running Apache 2.0 on a Windows XP system. I'm using a Perl script which uses the Inline C module. When I try to run it I get this error message

"Failed to autogenerate C:\Program Files\Apache Group\Apache2\cgi-bin\_Inline\config."

and after creating the directory myself this error message in the error log.

"Can't open C:\Program Files\Apache Group\Apache2\cgi-bin\_Inline\config for input."

How can I give the CGI script permission to create and write to arbitery directories?

I'm only doing local testing at home now so sucurity is not an issue.

Thanks for the help

Steve




Avatar of healthstatus
healthstatus

The write permissions to the directory need to be for LocalSystem account, (unless you have specifically told Apache to run as a different user).  Remember when you connect to the webserver, you are now using the webservers permissions (not your logged in user permissions).

g
Avatar of SketchySteve

ASKER

How do I log Apache on as a different user?

If I logged Apache on as Administrator would any CGI script be able to create directories and write to them?

It looks like I may only need to give write access to a dirctory the CGI script will access, does this make it easier.


Thanks for the help

Steve

PS- I've looked at some FAQs about how to log on Apache as a different user and they said it was done by including a line like this  

User Administrator
Group Administrator

To the httpd.conf file -  this just crashes my apache, is this only for earlier versions?  I'm running 2.0

Thanks

ASKER CERTIFIED SOLUTION
Avatar of healthstatus
healthstatus

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have tried this and i'm still getting errors

[Tue Apr 06 18:30:41 2004] [error] [client 127.0.0.1] Premature end of script headers: metasearch.pl
[Tue Apr 06 18:30:41 2004] [error] [client 127.0.0.1] Undefined subroutine &main::greet called at C:/Program Files/Apache Group/Apache2/cgi-bin/metasearch.pl line 18.\r

From what I understand these are probably permision errors but I created a new Administrator account called Apache. I then went into Services Logon and entered ".\Apache" as the username with the correct password.

After doing this Apache still worked (so I assume I didnt go too wrong), but still my script wont run.

To give a little more background i'm trying to use the Inline C module which gives the following description of CGI implementation.

"The problem with running Inline code from a CGI script is that Inline writes to a build area on your disk whenever it compiles code. Most CGI scripts don't (and shouldn't) be able to create a directory and write into it.

The solution is to explicitly tell Inline which directory to use with the 'use Inline Config => DIRECTORY => ...' line. Then you need to give write access to that directory from the web server (CGI script)."


How do I do this in XP? I've told Inline to use a number of directories and i'm still getting these error messages. If Apache is running on an Admin account why is this happening?

Thanks in advance

Steve




Thanks for the help healthstatus, you solution did work but it was obscured by another error as soon as I solved that problem.

Cheers

Steve