Home > Backend Development > PHP Tutorial > Configure php and cgi server with Apache Server_PHP tutorial

Configure php and cgi server with Apache Server_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:21:47
Original
869 people have browsed it

Nowadays, more and more personal homepage webmasters need to know how to configure their own PHP and CGI servers under Windows systems to facilitate local debugging of CGI and PHP programs.
We can use Apache (windows version) to do it all at once: The following is an article compiled by myself about the installation and configuration of Apache Server in a stand-alone Windows environment. If you are testing your website in a Windows stand-alone environment, it is recommended that you refer to it.
Mainly includes: installing and configuring Apache Server; using Perl CGI scripts; using PHP scripts.
--Refer to "Apache Server System Administrator Manual" for some content.
1. Installation under Windows
Of course, you must first have the Apache installation program. You might as well go to http://www.apache.org/dist to have a look. Here is a list of Apache mirror sites around the world to find the one closest to you. If you are in China, I suggest you go to the software house to have a look. The general file name of A pache's installation program is apache_1_3_x.win32.exe. Put it into your machine and run it.
The installation program will prompt you to modify the default directory location of Apache installation C:Program FilesApache GroupApache. In order to facilitate future configuration and maintenance, it is recommended that you install it in the root directory, such as C: Apache. After that, you will be prompted to select the installation type. It is recommended that you select Custom so that you will know what is installed. Specific projects include Application File, Source Code, Apache Manual, Additional Modules, Icons, and Repuired Directories. You can decide how to install it based on your situation.
If everything goes well (there should be no problems at this point), the installation will be completed soon. Apache will automatically complete some basic configurations. You can use UltraEdit-32 (or other text editing software) to open the c onfhttpd.conf file to get a rough idea.

2. Configure Apache Server


The first thing to do here is the basic configuration so that your Apache Server can run as you wish.
Use UltraEdit-32 (or other text editing software) to open the confhttpd.conf file.
1. Find ServerName. Define your domain name here. In this way, when Apache Server is running, you can access your site in the browser. If there is a # in front of it, remember to delete it. This is the comment mark of conf.
2. Find ServerAdmin. Enter your email address here. If you only use it on a single computer, it doesn't matter whether you change it or not.
3. Found. There is a sentence Options at the bottom, remove all the following parameters, and add an All (note that it is case-sensitive! The same below.); then there is a sentence Allow Override, also remove all the following parameters, and add an All.
4. Find DocumentRoot. This statement specifies the path of your website, which is the directory where your homepage is placed. You can use the default one, or you can specify one yourself, but remember, do not use ?quot;/ " at the end of this sentence. Also note that the "" of the directory is written as "/" in Apache Server.
5. Find DirectoryIndex . This is the first displayed homepage of your site.
After changing these, you can see your own homepage. If not, follow the steps above to modify it carefully. 3. Add support for Perl CGI scripts
To make your Apache Server support CGI scripts, you must first install Perl for Win32. The installation process will not be described in detail here. It is assumed that Perl is installed in the C:Perl directory. . Open the httpd.conf file.
1. Find ScriptAlias ​​/cgi-bin/ "C:/Apache/cgi-bin/" and delete the # in front of it and point the path in "" to the directory where you store the CGI script. , that is, the CGI script in this directory can be executed.
2. Find it. Point the path in "" to the directory where you store the CGI script, and change the parameters of Options and Allow Override to the same. All.
3. Find AddHandler cgi-script .cgi. Delete the # in front and add .pl at the end. Note: The Perl interpretation path in the CGI script is changed to: #!C:perl inperl. . Otherwise, a 500 error will occur.
4. Add support for PHP scripts
Likewise, the Windows version of PHP needs to be installed.
In the httpd.conf file. Add:
ScriptAlias ​​/php/ "c:/php/"
AddType application/x-httpd-php3 .php3 .php .phtml
Action application/x-httpd-php3 "/php/ php.exe"
Your PHP script can be placed anywhere on the site (except cgi-bin).
At this point, your Apache Server can support both CGI and PHP. How about it, not bad. Good luck!

http://www.bkjia.com/PHPjc/532393.html

truehttp: //www.bkjia.com/PHPjc/532393.htmlTechArticleNow more and more personal homepage webmasters need to know how to configure their own php under the windows system. cgi server to facilitate local debugging of cgi and php programs. We can use Apa...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template