470,810 Members | 915 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,810 developers. It's quick & easy.

Running cgi (or perl at all) in apache

Kelicula
176 Expert 100+
I have installed Activestate perl with Apache 2.2 and I can't get perl written cgi scripts to run.

I have changed the conf file to this

<Directory "htdocs/cgi-bin">
SetHandler cgi-script
Options ExecCGI
</Directory>

And I have:

<IfModule dir_module>
DirectoryIndex index.html index.shtml index.cgi
</IfModule>

And:

<Directory "htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks ExecCGI Includes

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>

As well as:

LoadModule cgi_module modules/mod_cgi.so

And:

AddHandler cgi-script .cgi
AddHandler server-parsed .html

AND!:
ScriptInterpreterSource registry

I have set my file types to open the command line interpreter for the "open" action of files with .cgi

And I can't get cgi scripts to function properly on my Windows XP SP2 box.


Anyone been through this??

Help!!

:)

When I try to open a page that has perl it just says waiting for localhost...
In my status bar, all other pages work. Even SSI enabled...
Oct 19 '07 #1
2 3088
numberwhun
3,503 Expert Mod 2GB
I have installed Activestate perl with Apache 2.2 and I can't get perl written cgi scripts to run.

I have changed the conf file to this

<Directory "htdocs/cgi-bin">
SetHandler cgi-script
Options ExecCGI
</Directory>

And I have:

<IfModule dir_module>
DirectoryIndex index.html index.shtml index.cgi
</IfModule>

And:

<Directory "htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks ExecCGI Includes

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>

As well as:

LoadModule cgi_module modules/mod_cgi.so

And:

AddHandler cgi-script .cgi
AddHandler server-parsed .html

AND!:
ScriptInterpreterSource registry

I have set my file types to open the command line interpreter for the "open" action of files with .cgi

And I can't get cgi scripts to function properly on my Windows XP SP2 box.


Anyone been through this??

Help!!

:)

When I try to open a page that has perl it just says waiting for localhost...
In my status bar, all other pages work. Even SSI enabled...
Kelicula,

I have Active State and Apache installed on my windows machine, and if I remember right, it was already configured by default for CGI (using Perl scripts).

First, your scripts (cgi) would need to be placed into your c:\Program Files\Apache Software Foundation\Apache2.2\cgi-bin folder. There is already a script in there called printenv.cgi (or .pl).

In your c:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf file, you will need to change the following. There is a section that talks about the shebang line in the Perl scripts. You will need to change what ever is there to be "#!c:/perl/bin" as that is where ActiveState installed to. Once you do that, save it.

That shebang line is what you should put at the top of your perl cgi scripts. If it is not there, then the script will not run and you will probably get something like a 503 error. Also, the script (printenv.cgi) will probably not have the correct shebang line so change it and save it.

In the conf file by the way, you will also want to make sure you have ServerName set to "www.localhost.com:80", unless you are hosting for yourself.

Once you do that, it should be fine.

Also, for your reference, you can read this link.


Regards,

Jeff
Oct 25 '07 #2
Kelicula
176 Expert 100+
Thanks! I'm running cgi now. I am still having some issues though, I think it is because I have altered my conf file so much, I can't tell what's been altered or not anymore.

I need to unintall, and reinstall, then save a copy of the default conf file somewhere else to be able to go back to it if needed.

Word to wise, save a backup of the conf file!!
Oct 26 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Rolfe | last post: by
1 post views Thread by David Cantin | last post: by
1 post views Thread by kesava81 | last post: by
3 posts views Thread by ogo796 | last post: by
6 posts views Thread by rois | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.