Solved

Allowing a CGI script to create and write to a directory

Posted on 2004-04-05
5
412 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now