Resolves an issue where the script's source code is always displayed in the Web page instead of executing the results when accessing CGI scripts on Apache

Source: Internet
Author: User

Apache supports CGI scripts, but requires four conditions to be guaranteed:

1. The folder in which the CGI script is placed itself needs to open X (that is, executable) permissions to the Apache server, the user (typically the default username is the user mechanism under Www,linux. Baidu).

2. The script itself must open X permissions to the Apache server user

3. The first line of the script with information on how to use what interpreter to execute the script code

Like the first line of a Python script

#!/usr/bin/env python

4.apache need to load mod_cgi.so this dynamic link library

The last problem is not often encountered but is often fatal because it is easily overlooked.

Here you need to familiarize yourself with the directory structure of Apache (see http://blog.csdn.net/jibcy/article/details/8060651), And the 2.2 and 2.4 two versions of the structure are not quite the same, but just 2.4 more detailed, the basic principle is still similar. So the above problem through in the configuration file (can be directly httpd.conf/apache2.conf or specification some look at the file included in the statement of which the supplemental configuration file is tube modules to that inside also line) plus

LoadModule cgi_module/usr/lib/apache2/modules/mod_cgi.so solution. (Note that/usr/lib/apache2/modules/mod_cgi.so is my computer's mod_cgi.so storage path, if it is not the path to find mod_cgi.so to store the place).

Resolves an issue where the script's source code is always displayed in the Web page instead of executing the results when accessing CGI scripts on Apache

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.