Solved

Allowing a CGI script to create and write to a directory

Posted on 2004-04-05
5
420 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

Question has a verified solution.

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

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

737 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