More and more webmasters need to know how to configure their own php and cgi servers in windows to debug cgi and php programs locally.
We can use Apache (windows version) to solve this problem: The following articles about installing and configuring Apache Server in a single Windows environment are compiled by myself. If you are testing your website in a Windows single-host environment, we recommend that you refer to it.
It mainly includes installing and configuring Apache Server, using Perl CGI scripts, and using PHP scripts.
-- For some content, see Apache Server System Administrator Manual.
1. Installation in Windows
Of course, you must first have an Apache installation program. Visit http://www.apache.org/dist. Here is a list of Apache image sites worldwide. Find the one closest to you. If you are in China, we suggest you go to the software house. The file name of A pacheinstaller is apache_1_3_x.win32.exe. Run it on your machine.
The installer will prompt you to modify the default directory C: Program FilesApache GroupApache for Apache installation. To facilitate future configuration and maintenance, we recommend that you install it in the root directory, for example, C: Apache. Then, you will be prompted to select the installation type. We recommend that you select "cuz tom". In this way, you will know what to install. Specific projects include Application File, Source Code, Apache Manual, Additional Modules, and Icons), Repuired Directories (required directory ). You can decide how to install it based on your situation.
If everything goes well (there should be no problem at this time), the installation will be completed soon. Apache will automatically complete some basic configuration, you can use the UltraEdit-32 (or other text editing software) to open the c onfhttpd. conf file for a general understanding.
II. Configure Apache Server
The first step here is the basic configuration so that your Apache Server can run as you wish.
Open the confhttpd. conf file with a UltraEdit-32 (or other text editing software.
1. Find ServerName. Your domain name is defined here. In this way, when the Apache Server is running, you can access your site in the browser. If there is # above, remember to delete it. This is the comment mark of conf.
2. Find ServerAdmin. Enter your email address here. If you use it only on a single machine, it doesn't matter if you don't change it.
3. Search. There is an option below, removing All the following parameters and adding an All (case sensitive! The same below .); Then there is an Allow Override statement, which also removes All the following parameters and adds an All.
4. Find DocumentRoot. This statement specifies the path of your website, that is, the directory on your home page. You can use the default one or specify one by yourself, but remember not to "/" at the end of the sentence "/". In addition, the directory "" is written in Apache Server "/".
Conversion from: ITU tutorial network [www.w.w.w.com] 5. Find the DirectoryIndex. This is the first homepage displayed on your site.
After these changes, you can start Apache Server. Did you see your home page? If not, follow the steps above to modify it carefully.
III. Added support for Perl CGI scripts
To make your Apache Server support CGI scripts, you must first install Perl for Win32. The installation process is not detailed. Assume that Perl is installed in the C: Perl directory. Open the httpd. conf file.
1. Find ScriptAlias/cgi-bin/"C:/Apache/cgi-bin /". Delete the previous # 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. Search. Point the path in "" to the directory where your CGI script is stored, which must be the same as the above. Change the Options and Allow Override parameters to All.
3. Find AddHandler cgi-script. cgi. Delete the previous # and Add. pl.
Note: in the CGI script, the Perl interpretation path is changed :#! C: perlbinperl. Otherwise, a 500 error occurs.
4. Added support for PHP scripts
Similarly, you also need to install the Windows version of PHP. Suppose the installation is in the C: php directory.
Add the following to the httpd. conf file:
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 ).
Now, your Apache Server supports both CGI and PHP.
How are you doing. Good luck!