Solved

Allowing a CGI script to create and write to a directory

Posted on 2004-04-05
5
415 Views
Last Modified: 2013-11-18
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




0
Comment
Question by:SketchySteve
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:healthstatus
ID: 10760559
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
0
 
LVL 1

Author Comment

by:SketchySteve
ID: 10760913
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

0
 
LVL 2

Accepted Solution

by:
healthstatus earned 80 total points
ID: 10761084
You should be able to go into the administrative tools/services window and bring up the Apache service and change the user login there (if you are running apache as a service).
0
 
LVL 1

Author Comment

by:SketchySteve
ID: 10768124
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




0
 
LVL 1

Author Comment

by:SketchySteve
ID: 10770903
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
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question