Running cgi scripts anywhere

software development

#1

I have a problem when installing applications consisting mainly of cgi scripts. They ask to be installed in the cgi-bin directory.
I dont want to do this for a number of reasons, and dont even know if it is possible to do with a shared hosting account.

So is it possible to make a softlink to the cgi-bin dir or change a setting such that I can run cgi scripts from anywhere?


#2

You don’t need to change anything. At DreamHost, CGI scripts can be run from anywhere by default.

You can of-course create your own cgi-bin directory and place your cgi files within that, if it makes things easier.

Mark


Save [color=#CC0000]$50[/color] on DreamHost hosting using promo code [color=#CC0000]SAVEMONEY[/color] ( Click for promo code details )


#3

Ah ok, thx.

I tried to instal CGI:IRC see: http://cgiirc.sourceforge.net/
So if cgi is working, then perl might be the culprit.
But I figured it would work with dreamhost very easily, since the author gives a plug for dreamhost on this page:
http://cgiirc.sourceforge.net/download/

The install instructions said to do this:
“2. Copy or upload all the files to your cgi-bin directory, and put the images directory in the correct location (may or may not be inside the cgi-bin directory).”

So I won’t bother with the cgi-bin dir. Instead the files are all in a directory I have created (with 755 permissions).
I’ve checked that all the relevent files have 755 permissions.

When I point my browser to the directory, I just get a listing of the files.
The FAQ does mention this:
“The default path to perl in the scripts is /usr/bin/perl, this is the correct path on almost all systems, however sometimes other paths are used, /usr/local/bin/perl being one of the most common”

Is /usr/bin/perl the correct path on dreamhost shared accounts?


#4

I am not familiar with the package you are trying to install, but this would indicate that there is no index file (html, php or cgi) in the directory.

Yes. According to the wiki, the Perl interpreter can be found at /usr/bin/perl and /usr/local/bin/perl

http://www.wiki.dreamhost.com/index.php/KB_/Web_Programming/_CGI,PHP&_Databases

Mark


Save [color=#CC0000]$50[/color] on DreamHost hosting using promo code [color=#CC0000]SAVEMONEY[/color] ( Click for promo code details )


#5

thanks for that. I renamed the irc.cgi script as index.cgi
I’m almost there now.
I had to reupload the scripts as ASCII files and the images as binary files via ftp.
I am now getting the login page for CGI:IRC, but attempting to login gives me an internal server message.

According to the troubleshooting tips, this indicates the server doesn’t support nph (non-header parsed) CGI scripts and streams. It says “Apache is known to support these in the default configuration, but modules such as mod_gzip and some CGI wrappers stop streams working”

I uploaded a test script to check for streaming and it failed.

SO I had a look at the server modules and sure enough:
Apache/1.3.33 (Unix) mod_throttle/3.1.2 DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a PHP/4.4.2 mod_ssl/2.8.22 OpenSSL/0.9.7e

The docs say I can exclude CGI:IRC from mod_gzip by using:
mod_gzip_item_exclude file nph-.*.cgi$

But they don’t say how.
I presume thats a command to be typed in from a shell account?
Does it need to be typed in everytime I use the cgi:irc scripts, or just once?
Will that command work if I insert it as 1st line of the index.cgi script?

Thanks in advance for your help. :slight_smile:


#6

This would normally be added to the Apache configuration file. However, on shared hosting you do not have access to this configuration file.

You may be able to achieve the same results by adding the line to your .htaccess file.

Mark


Save [color=#CC0000]$50[/color] on DreamHost hosting using promo code [color=#CC0000]SAVEMONEY[/color] ( Click for promo code details )


#7

Yup, adding that to the .htaccess works Raz2133, thanks.