How should we setup to execute CGI or Perl or PHP script through httpd?
Environment
- Red Hat Enterprise Linux (RHEL)
- 5.x
Issue
- How should we setup to execute a CGI or Perl or PHP script through httpd?
Resolution
CGI
-
Deploy the CGI script to /var/www/cgi-bin/ directory (or the ScriptAlias directory specified in httpd.conf).
-
Change permissions to execute the script.
-
Access http://your_domain/cgi-bin/your_cgi_script.
Perl
- Install a mod_perl package.
- Edit /etc/httpd/conf.d/perl.conf (drop hash signes to enable handler.)
Alias /perl /var/www/perl <Directory /var/www/perl> SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI </Directory> - Deploy the Perl script to /var/www/perl/ directory.
- Change permissions to read the script.
- Access http://your_domain/perl/your_perl_script.
-
Install a php package.
-
Deploy the PHP script to /var/www/html/ directory with a .php extension.
-
Change permissions to read the script.
-
Access http://your_domain/your_php_script.
Root Cause
- To execute scripts through httpd, Red Hat Enterprise Linux provides four modules: mod_cgi (httpd package), mod_perl, mod_php (php package) and mod_python.
Comments
See also:
- Content from httpd.apache.org is not included.Content from httpd.apache.org is not included.http://httpd.apache.org/docs/2.2/
- Content from perl.apache.org is not included.Content from perl.apache.org is not included.http://perl.apache.org/docs/2.0/
- Content from www.php.net is not included.Content from www.php.net is not included.http://www.php.net/manual/en/
- Content from www.modpython.org is not included.Content from www.modpython.org is not included.http://www.modpython.org/live/mod_python-3.2.8/doc-html/
SBR
Product(s)
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.