LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Running .cgi and .pl scripts from any subdirectory in Apache (https://www.linuxquestions.org/questions/linux-networking-3/running-cgi-and-pl-scripts-from-any-subdirectory-in-apache-420995/)

b18b 03-02-2006 12:38 PM

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.

RHELL 03-02-2006 12:51 PM

ExecCGI

http://httpd.apache.org/docs/2.0/howto/cgi.html

b18b 03-02-2006 01:05 PM

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?

RHELL 03-02-2006 05:07 PM

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.

b18b 03-13-2006 03:04 PM

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.

b18b 03-13-2006 06:51 PM

Here's what gets me is that the .cgi scripts work just fine from the command prompt.

shaunw 03-17-2006 11:53 PM

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?

b18b 03-18-2006 03:32 AM

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.

b18b 03-20-2006 02:43 PM

Problem solved -> http://www.linuxquestions.org/questi...d.php?t=426662


All times are GMT -5. The time now is 07:31 AM.