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