Configure support for PHP and CGI on the Windows Apache server _linux

Source: Internet
Author: User
Tags php script win32 ultraedit

Now there are more and more personal home owners who need to know how to configure their own php,cgi servers under Windows system to facilitate local debugging of CGI and PHP programs.

We can do this in Apache (Windows version): Here's my own article about installing and configuring Apache Server in a stand-alone Windows environment. If you are testing your Web site in a stand-alone Windows environment, you are advised to refer to it.

This includes: Installing and configuring Apache Server, using Perl CGI scripts, and using PHP scripts.

--Some of the contents refer to the Apache Server system Administrator's Handbook.

Installation under Windows

Of course, you first have to have Apache installer. You may wish to see Http://www.apache.org/dist first. Here's a list of the world's Apache mirror sites to find the one closest to you. If at home, it is recommended that you go to the software room to see. A pache installer typically has a filename of apache_1_3_x.win32.exe. Take it to your machine and run it.

The installer prompts you to modify the default directory location for Apache installation C:Program Filesapache Groupapache. In order to facilitate later configuration and maintenance, it is recommended that you install in the root directory, such as C:apache. After that, you will be prompted to choose the type of installation and suggest you choose Cus tom (custom) so that you will know what is installed. Concrete items are application file (application file), source code (source), Apache Manual (Apache manual), Additional Modules (add-on module), Icons (icon), repuired Directories (required directory). You can decide how to install it according to your situation.

If all goes well (there should be no problem at this point), the installation will be completed soon. Apache will automatically complete some basic configuration, you can use ULTRAEDIT-32 (or other text editing software) to open the C onfhttpd.conf file for a general understanding.

Second, configure Apache Server

The first thing to do here is the basic configuration so that your Apache server will run as you wish.

Open the confhttpd.conf file with UltraEdit-32 (or other text editing software).

1, to find servername. Define your domain name here. This way, when Apache server is running, you can access your site in the browser. If there is a # before, remember to delete it, this is the note mark of Conf.

2, to find serveradmin. Enter your e-mail address here. If you are only a stand-alone use, change does not matter.

3, to find. Down there is a word of options, remove all the parameters behind, plus a all (focus on case-sensitive!) Same And then there is a allow Override, which also removes all of the following parameters, plus one.

4, to find DocumentRoot. This statement specifies your site's path, which is the directory where your home page is located. You can use the default, or you can specify one yourself, but remember that at the end of this sentence do not "/". In addition, the catalogue "" is written "/" in the Apache server.

From: Ituri tutorial Network [www.etoow.com] 5, looking for the directoryindex. This is the home page that your site first displays.
After you change these, you can start Apache server. Did you see your homepage? If not, follow the steps above to revise carefully.

Iii. increased support for Perl CGI scripts

To enable your Apache server to support CGI scripts, you must first install the Perl for Win32. The installation process is not specifically described. This assumes that Perl is installed in the C:perl directory. Open the httpd.conf file.

1, to find scriptalias/cgi-bin/"c:/apache/cgi-bin/". Delete the previous # and point the path in the directory where you stored the CGI script, that is, the CGI script in this directory can be executed.

2, to find. Point the path in the "" to the directory where you stored the CGI script, the same as above. Change the options, Allow override parameters to all.

3. Find the AddHandler cgi-script. CGI. Delete the front #, and Add. pl to the back.
Focus: Perl Interpretation in CGI scripts is changed to: #! C:perlbinperl. Otherwise, there will be a 500 error.

Iv. increasing support for PHP scripts

Also, there is a need to install the Windows version of PHP. Suppose installed in the c:php directory.

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 in the site (except Cgi-bin).

With this, your Apache Server can support both CGI and PHP.

Yes, it's good. Good luck!

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.