LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-02-2006, 01:38 PM   #1
b18b
Member
 
Registered: Nov 2005
Distribution: PCLinuxOS .92
Posts: 80

Rep: Reputation: 15
Running .cgi and .pl scripts from any subdirectory in Apache


I have searched Google and this site and am still confused.

How and what do I need to change in the httpd.conf file to allow running of .pl and .cgi scripts from anywhere on my server?

I tried a .htaccess file but it doesn't seem to do anything. Since they work in the cgi-bin directory and not others, its a configuration thing.

Please help.
 
Old 03-02-2006, 01:51 PM   #2
RHELL
Member
 
Registered: Feb 2004
Location: Outermost mingetty
Distribution: RHEL3,RH4U4,Sol9, Sol10
Posts: 321

Rep: Reputation: 31
ExecCGI

http://httpd.apache.org/docs/2.0/howto/cgi.html
 
Old 03-02-2006, 02:05 PM   #3
b18b
Member
 
Registered: Nov 2005
Distribution: PCLinuxOS .92
Posts: 80

Original Poster
Rep: Reputation: 15
Thanks. I read that one as well from my searches.

There is a lot in the httpd.conf file and it looks like I can mess things up pretty bad by entering the incorrect information. I guess that is where I am stuck.

All I am looking at doing is allowing any .cgi and .pl script to run under the directory /var/www/html and all subdirectories.

Is it correct to just add

<Directory "/var/www/html">
Options ExecCGI
AddHandler cgi-script .cgi .pl
order allow,deny
allow from all
</Directory>

and

what should I put for a ScriptAlias?
 
Old 03-02-2006, 06:07 PM   #4
RHELL
Member
 
Registered: Feb 2004
Location: Outermost mingetty
Distribution: RHEL3,RH4U4,Sol9, Sol10
Posts: 321

Rep: Reputation: 31
There is only one ScriptAlias directory per host(or VirtualHost). If you need additional locations to run cgi, that's why ExecCGI exists. Since your scripts run in cgi-bin, that is presumably already ScriptAlias'ed. (ScriptAlias behaves as Alias+ExecCGI)

Not sure you need AddHandler again in there if it's working globally.

.htaccess may not work unless you have a proper AllowOverride, depends on your globals. Easiest to get it working, then dial down authentication.

File ownership and permissions will bite you too......not that I've ever made that mistake myself.
 
Old 03-13-2006, 04:04 PM   #5
b18b
Member
 
Registered: Nov 2005
Distribution: PCLinuxOS .92
Posts: 80

Original Poster
Rep: Reputation: 15
I had to put this on the back burner for a little while, but I am now back. Problems still exist. They do not seem consistant.

In one directory when I run a rather simple script, I get this error -> Software Error: permission denied (on a file that is trying to be updated.

Then in another subdirectory on a more complex script I get this error -> Error 500 with Premature end of script headers:

I have tried to follow what is being suggested above, but I am still somewhat confused with this permissions thing.
 
Old 03-13-2006, 07:51 PM   #6
b18b
Member
 
Registered: Nov 2005
Distribution: PCLinuxOS .92
Posts: 80

Original Poster
Rep: Reputation: 15
Here's what gets me is that the .cgi scripts work just fine from the command prompt.
 
Old 03-18-2006, 12:53 AM   #7
shaunw
Member
 
Registered: Dec 2005
Posts: 77

Rep: Reputation: 15
Smile cgi scripts

Have you set the permissions on your cgi scripts to be
'executable by all users'? Do all users have permission to enter
the directory where the scipts are stored?
 
Old 03-18-2006, 04:32 AM   #8
b18b
Member
 
Registered: Nov 2005
Distribution: PCLinuxOS .92
Posts: 80

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by shaunw
Have you set the permissions on your cgi scripts to be
'executable by all users'?
Yes. For sure. I also tried changing ownership to apache with same results.

Quote:
Originally Posted by shaunw
Do all users have permission to enter
the directory where the scipts are stored?
Would you mind expanding on this a little. It should be ok. The script that I have needs to access files in another directory, but further up in the same branch.
 
Old 03-20-2006, 03:43 PM   #9
b18b
Member
 
Registered: Nov 2005
Distribution: PCLinuxOS .92
Posts: 80

Original Poster
Rep: Reputation: 15
Problem solved -> http://www.linuxquestions.org/questi...d.php?t=426662
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problems in running cgi/perl scripts... raymond Linux - General 17 02-09-2010 05:06 AM
Running perl scripts outside of cgi-bin ylikone Programming 1 09-08-2005 05:34 AM
Running CGI scripts in Tomcat 4...not happening!!! vous Linux - Software 2 02-05-2004 04:52 AM
running cgi scripts in other directories init-5 Linux - Software 2 09-16-2003 04:01 PM
Running Perl/CGI scripts hso_sof Linux - Newbie 3 08-22-2003 11:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration