Installation configuration for Apache and PHP under Windows NT (i)

Source: Internet
Author: User
One of the most frequently asked questions in the PHP mailing list might be: "How do I install PHP on my windows machine?" "Then maybe I can help answer that question." When you're done properly, you'll find it's good to develop a PHP program under Windows.

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

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

First, install Apache

First of all, you need a Web server, I recommend Apache. Take a look at htp://www.apache.org/dist first. On this page you'll find a list of the Apache mirror sites around the world that are 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 you will have to modify its configuration file immediately. If there is nothing wrong with the installation, Apache can use it. There are many readme files to refer to, but only one file is on the Win32 platform, including window 9x and Windows NT.

Second, install PHP

There are too many occurrences of this problem in the PHP mailing list. You need to install the latest version of Windows PHP. You might think of yourself compiling PHP3, 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 have to do is unzip the file you're down to (WinZip is good) to your favorite directory, like 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 the updated version in the future.

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

Third, configure PHP

There is a Readme file in the package that was distributed with PHP, which describes how to configure it. There is a file named Php.ini-dist, which is the main configuration file for PHP. Copy it to your Windows system directory (Windows 9x \ \ \ Windows NT \winnt directory) and rename it to PHP.ini. This file needs to be modified appropriately, the most important thing is to add some of the modules that may be used, such as MySQL. Find this section in the php.ini file as follows:

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions;
;;;;;;;;;;;;;;;;;;;;;;
; If you wish to a extension loaded automaticly, use the
; Following syntax:extension=modulename.extension
; For example, on Windows,
; Extension=msql.dll; or under UNIX,
; Extension=msql.so
; Note that 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 commented, such 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 some of the lines of the file, i.e. delete the beginning semicolon. I need MySQL support myself, remove the semicolon from the "Extension=php3_mysql.dll" line, and in certain cases the DLL file you want to use 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 first section where you install the Apache directory, open the. \conf\httpd.conf file with your favorite file editor (preferably support Win32 long file name format, such as edit, UltraEdit, etc.), 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 don't understand what's inside, go to the Apache documentation. 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"



The above describes the Apache and PHP installation configuration under Windows NT (a), including the Apache and PHP installation aspects, I hope to be interested in PHP tutorial friends helpful.

  • 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.