Apache, PHP installation and configuration under Windows 9x/nt (i) _php Foundation

Source: Internet
Author: User
Tags install php win32
Probably the most asked question in the PHP mailing list is: "How do I install PHP on my windows machine?" "Then perhaps I can help to answer that question. When you are properly installed, you will find that it is good to develop PHP programs under Windows.

The purpose of this tutorial is to show you how to use the "Apache and Windows" combination to develop PHP programs.

If a specific version is not specified in the tutorial, PHP is PHP3 or PHP4 Beta 2 or 3,apache 1.3.x.

First, install Apache

First, you need a Web server, I recommend Apache. Let's go to htp://www.apache.org/dist first. On this page there is a list of the world's Apache mirror sites, finding the one closest to you. Apache software is generally called Apache_1_3_x.win32.exe. Take it to your machine and run it. It will ask you where to install Apache, you can set it to C:\Apache, because right now you will have to modify its configuration file. If there is nothing wrong with the installation, Apache can be used. There are many Readme files available for reference, but only one file is for the Win32 platform, including window 9x and Windows NT.

Second, the installation of PHP

This problem appears too many times in the PHP mailing list. You need to install the latest Windows version of PHP. You might think of compiling PHP3 yourself, but I don't think it's necessary for general development purposes. PHP also has mirror sites all over the world (China does not seem to be). Select a mirror, locate the download area, select "Source Code and Windows distribution" and download "Windows Binary". All you need to do is unzip the file (WinZip) into your favorite catalogue, such as C:\PHP4B3. I recommend using the version number as the directory name so that you don't have to delete the old version when you try to update it later.

Installing PHP4 Beta under Windows 95/97 requires the support of DCOM. If your machine is not installed, download a copy here.

Third, configure PHP

The package that is distributed with PHP has a readme file that tells you how to configure it. There is a file named Php.ini-dist, which is the primary configuration file for PHP. Copy it to your Windows system directory (Windows 9x or Windows NT \WINNT directory) and rename it to PHP.ini. You need to make appropriate changes to this file, the most important thing is to add a number of possible modules, such as MySQL. Find this section in the php.ini file as follows:

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions;

; If you are wish to have a extension loaded automaticly, use the
; Following syntax:extension=modulename.extension
; For example, on Windows,
; Extension=msql.dll; or under UNIX,
; Extension=msql.so
; The It should is the name of the module only,
; No directory information needs to go.
; Specify the location of the extension with the
; EXTENSION_DIR directive above.

The next few lines are annotated, as

; Windows Extensions
; Extension=php_mysql.dll
; Extension=php_nsmail.dll
; Extension=php_calendar.dll
; Extension=php_dbase.dll
; Extension=php_filepro.dll
...

All you have to do is remove the comments from some lines of the file, that is, delete the beginning semicolon. I need MySQL support myself, I removed the semicolon from the "Extension=php3_mysql.dll" line, and in certain cases, the DLL file you are using is not in this list, simply add a line, such as: "Extension= MyDLL.DLL ". In this way, PHP is configured well.

Four, let Apache work with PHP

Find the directory in the first section where you installed Apache, and open it with your favorite file editor (preferably support Win32 long filename format, such as edit, UltraEdit, etc.). \conf\httpd.conf file, in this case c:\Apache\conf\ Httpd.conf (This is Apache's most important configuration file, do not easily modify, unless there is a certain certainty). If you do not understand the contents of the inside, you can go to participate in the Apache document. To get Apache to work with PHP, you can just add a few lines, as follows:

scriptalias/php4b3/"c:/php4b3/"
AddType application/x-httpd-php3. php3
AddType application/x-httpd-php3. php
AddType application/x-httpd-php3. phtml
Action application/x-httpd-php3 "/php4b3/php.exe"

It should be noted that the above three lines can not be incorrectly written. The last part of the first line is the directory of PHP you installed, and the next two lines you can copy and paste directly from here. This line of configuration commands are case-sensitive.

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.