apache setup/enabling execution of cgi scripts

apache setup/enabling execution of cgi scripts

Post by Jason Byrn » Fri, 31 Dec 1999 04:00:00



might be better if you posted your script...

of particular interest... whether you have the correct location for perl at
the top of the script

#!/usr/bin/perl

do a 'which perl' to figure out where it is.

Also... the permissions on hello.pl or whatever it is should be 755... along
with your actual cgi-bin directory (/usr/local/httpd/cgi-bin or wherever it
is on your machine)

Arthur Shmurun wrote in message <84gcb2

$j4...@nntp5.atl.mindspring.net>...
>I am having problems getting a simple hello world perl script to execute. I

am running apache on
>linux. apache appears to be installed as it is responding to http calls.
The script runs and
>prints what it should when called all by itself-execute pemission was set.

>A simple form with text input and a submit button is supposed to execute

the script. When the
>submit button is pressed, the listing of the script appears instead of the
result of executing
>it.
>Also, the correct values appear in the url ( using the Get method).

>Below is a copy of the httpd.conf file.

>Please give any suggestions regarding server configuration, etc... and mail
a copy of your
>response to:

>ar...@ix.netcom.com

>Thank you in advance

>Art
>___________________________________________________________________
>## httpd.conf -- Apache HTTP server configuration file
>##

># This is the main server configuration file. See URL

http://www.apache.org/

- Show quoted text -

># for instructions.

># Do NOT simply read the instructions in here without understanding
># what they do, if you are unsure consult the online docs. You have been
># warned.

># Originally by Rob McCool

># Dynamic Shared Object (DSO) Support
>#
># To be able to use the functionality of a module which was built as a DSO
you
># have to place corresponding `LoadModule' lines at this location so the
># directives contained in it are actually available _before_ they are used.
># Please read the file README.DSO in the Apache 1.3 distribution for more
># details about the DSO mechanism and run `httpd -l' for the list of
already
># built-in (statically linked and thus always available) modules in your
httpd
># binary.
>#
># Example:
># LoadModule foo_module libexec/mod_foo.so
>#
># Documentation for modules is in "/home/httpd/manual/mod" in HTML format.

>#LoadModule mmap_static_module modules/mod_mmap_static.so
>LoadModule env_module         modules/mod_env.so
>LoadModule config_log_module  modules/mod_log_config.so
>LoadModule agent_log_module   modules/mod_log_agent.so
>LoadModule referer_log_module modules/mod_log_referer.so
>#LoadModule mime_magic_module  modules/mod_mime_magic.so
>LoadModule mime_module        modules/mod_mime.so
>LoadModule negotiation_module modules/mod_negotiation.so
>LoadModule status_module      modules/mod_status.so
>LoadModule info_module        modules/mod_info.so
>LoadModule includes_module    modules/mod_include.so
>LoadModule autoindex_module   modules/mod_autoindex.so
>LoadModule dir_module         modules/mod_dir.so
>LoadModule cgi_module         modules/mod_cgi.so
>LoadModule asis_module        modules/mod_asis.so
>LoadModule imap_module        modules/mod_imap.so
>LoadModule action_module      modules/mod_actions.so
>#LoadModule speling_module     modules/mod_speling.so
>LoadModule userdir_module     modules/mod_userdir.so
>LoadModule proxy_module       modules/libproxy.so
>LoadModule alias_module       modules/mod_alias.so
>LoadModule rewrite_module     modules/mod_rewrite.so
>LoadModule access_module      modules/mod_access.so
>LoadModule auth_module        modules/mod_auth.so
>LoadModule anon_auth_module   modules/mod_auth_anon.so
>#LoadModule dbm_auth_module    modules/mod_auth_dbm.so
>LoadModule db_auth_module     modules/mod_auth_db.so
>LoadModule digest_module      modules/mod_digest.so
>#LoadModule cern_meta_module   modules/mod_cern_meta.so
>LoadModule expires_module     modules/mod_expires.so
>LoadModule headers_module     modules/mod_headers.so
>LoadModule usertrack_module   modules/mod_usertrack.so
>#LoadModule example_module     modules/mod_example.so
>#LoadModule unique_id_module   modules/mod_unique_id.so
>LoadModule setenvif_module    modules/mod_setenvif.so

># Extra Modules
>#LoadModule php_module         modules/mod_php.so
>#LoadModule php3_module        modules/libphp3.so
>#LoadModule perl_module        modules/libperl.so

>#  Reconstruction of the complete module list from all available modules
>#  (static and shared ones) to achieve correct module execution order.
>#  [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]
>ClearModuleList
>#AddModule mod_mmap_static.c
>AddModule mod_env.c
>AddModule mod_log_config.c
>AddModule mod_log_agent.c
>AddModule mod_log_referer.c
>#AddModule mod_mime_magic.c
>AddModule mod_mime.c
>AddModule mod_negotiation.c
>AddModule mod_status.c
>AddModule mod_info.c
>AddModule mod_include.c
>AddModule mod_autoindex.c
>AddModule mod_dir.c
>AddModule mod_cgi.c
>AddModule mod_asis.c
>AddModule mod_imap.c
>AddModule mod_actions.c
>#AddModule mod_speling.c
>AddModule mod_userdir.c
>AddModule mod_proxy.c
>AddModule mod_alias.c
>AddModule mod_rewrite.c
>AddModule mod_access.c
>AddModule mod_auth.c
>AddModule mod_auth_anon.c
>#AddModule mod_auth_dbm.c
>AddModule mod_auth_db.c
>AddModule mod_digest.c
>#AddModule mod_cern_meta.c
>AddModule mod_expires.c
>AddModule mod_headers.c
>AddModule mod_usertrack.c
>#AddModule mod_example.c
>#AddModule mod_unique_id.c
>AddModule mod_so.c
>AddModule mod_setenvif.c

># Extra Modules
>#AddModule mod_php.c
>#AddModule mod_php3.c
>#AddModule mod_perl.c

># ServerType is either inetd, or standalone.

>ServerType standalone

># If you are running from inetd, go to "ServerAdmin".

># Port: The port the standalone listens to. For ports < 1023, you will
># need httpd to be run as root initially.

>Port 80

># HostnameLookups: Log the names of clients or just their IP numbers
>#   e.g.   www.apache.org (on) or 204.62.129.132 (off)
># The default is off because it'd be overall better for the net if people
># had to knowingly turn this feature on.

>HostnameLookups off

># If you wish httpd to run as a different user or group, you must run
># httpd as root initially and it will switch.

># User/Group: The name (or #number) of the user/group to run httpd as.
>#  On SCO (ODT 3) use User nouser and Group nogroup
>#  On HPUX you may not be able to use shared memory as nobody, and the
>#  suggested workaround is to create a user www and use that user.
>#  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
>#  when the value of (unsigned)Group is above 60000;
>#  don't use Group nobody on these systems!

>User nobody
>Group nobody

># ServerAdmin: Your address, where problems with the server should be
># e-mailed.

>ServerAdmin root@localhost

># ServerRoot: The directory the server's config, error, and log files
># are kept in.
># NOTE!  If you intend to place this on a NFS (or otherwise network)
># mounted filesystem then please read the LockFile documentation,
># you will save yourself a lot of trouble.

>ServerRoot /etc/httpd

># BindAddress: You can support virtual hosts with this option. This option
># is used to tell the server which IP address to listen to. It can either
># contain "*", an IP address, or a fully qualified Internet domain name.
># See also the VirtualHost directive.

>#BindAddress *

># ErrorLog: The location of the error log file. If this does not start
># with /, ServerRoot is prepended to it.

>ErrorLog logs/error_log

># LogLevel: Control the number of messages logged to the error_log.
># Possible values include: debug, info, notice, warn, error, crit,
># alert, emerg.

>LogLevel warn

># The following directives define some format nicknames for use with
># a CustomLog directive (see below).

>LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
combined
>LogFormat "%h %l %u %t \"%r\" %>s %b" common
>LogFormat "%{Referer}i -> %U" referer
>LogFormat "%{User-agent}i" agent

># The location of the access logfile (Common Logfile Format).
># If this does not start with /, ServerRoot is prepended to it.

>CustomLog logs/access_log common

># If you would like to have an agent and referer logfile uncomment the
># following directives.

>#CustomLog logs/referer_log referer
>#CustomLog logs/agent_log agent

># If you prefer a single logfile with access, agent and referer information
># (Combined Logfile Format) you can use the following directive.

>#CustomLog logs/access_log combined

># PidFile: The file the server should log its pid to
>PidFile /var/run/httpd.pid

># ScoreBoardFile: File used to store internal server process information.
># Not all architectures require this.  But if yours does (you'll know
because
># this file is created when you run Apache) then you *must* ensure that
># no two invocations of Apache share the same scoreboard file.
>ScoreBoardFile /var/run/httpd.scoreboard

># The LockFile directive sets the path to the lockfile used when Apache
># is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or
># USE_FLOCK_SERIALIZED_ACCEPT. This directive should normally be left at
># its default value. The main reason for changing it is if the logs
># directory is NFS mounted, since the lockfile MUST BE STORED ON A LOCAL
># DISK. The PID of the main server process is automatically appended to
># the filename.
>#
>#LockFile /var/lock/httpd.lock

># ServerName allows you to set a host name which is sent back to clients
for
># your server if it's different than the one the program would get (i.e.
use
># "www" instead of the host's real name).
>#
># Note: You cannot just invent host names and hope they work. The name you
># define here must be a valid DNS name for your host. If you don't
understand
># this, ask your network administrator.

>#ServerName new.host.name

># UseCanonicalName:  (new for 1.3)  With this setting turned on, whenever
># Apache needs to construct a self-referencing URL (a url that refers back
>#

...

read more »

 
 
 

1. Using .cgi/.pl to enable CGI script in Apache

I am trying to run CGI scripts local to the companion HTML documents
using the Apache server and Linux. According to the manual if I add the
lines:

AddType application/x-httpd-cgi cgi pl
AddType application/x-httpd-cgi .cgi .pl
 (yeah - I wasn't sure whether or not to include the "." so I tried it
  both ways)

to the srm.conf and restart the server, that should do it.

Not true.

I get:
***********************************************************************
        Forbidden

You don't have permission to access /chamFarm/CFemail.pl on this server.
***********************************************************************

(where CFemail.pl is the script in the HTML home directory "chamFarm"
- as expected)

 the script has 777 permissions just to enable all possible
permissions.

If I take the lines out of the srm.conf file and restart the server, I
get:

***********************************************************************
Method not implemented

POST to /chamFarm/CFemail.pl not supported.
***********************************************************************
 which, I guess, is the sort of error you might expect.

So I don't see the problem. This should be very straightforward. Does
anyone have any ideas?

        Thanks for your time,
                Gary Whitten

2. Problem with: Apache/2.0.36 (Unix) mod_ssl/2.0.36 OpenSSL/0.9.6d

3. Execution of CGI scripts in Apache

4. Printing using Intel NetportExpress

5. Apache CGI/Perl script execution problem

6. Best Practices/Technologies for Open Systems Help Desk Mgmt.

7. Enabling .cgi execution in selected directories

8. Web Search Engine Query Trace

9. How can I enable cgi execution in user's home directories?

10. CGI script setup UNIX apache 0.8 system

11. apache: give /home/mailman/cgi-bin permissions to run cgi-scripts.

12. apache: cgi script not in cgi-bin

13. CGI script execution in SSL problem