Home > Backend Development > PHP Tutorial > Apache, PHP installation and configuration under Windows 9x/NT (1)_PHP tutorial

Apache, PHP installation and configuration under Windows 9x/NT (1)_PHP tutorial

WBOY
Release: 2016-07-21 16:00:40
Original
786 people have browsed it

Probably the most asked question on the PHP mailing list is: "How do I install PHP on my Windows machine?", so maybe I can help answer that question. When you have installed it correctly, you will find that it is good to develop PHP programs under Windows.

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

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

1. Install Apache

First of all, you need a WEB server, I recommend Apache. First go to http://www.apache.org/dist and take a look. On this page is a list of Apache mirror sites worldwide, find the one closest to you. Apache software is generally called apache_1_3_x.win32.exe. Put it into your machine and run it. It will ask you where to install Apache. You can set it to c:Apache because you will need to modify its configuration file soon. If nothing goes wrong with the installation, Apache will be ready to use. There are many readme files for reference, but only one file talks about the Win32 platform, including Window 9x and Windows NT.

2. Install PHP

This question appears too many times in the PHP mailing list. You need to install the latest Windows version of PHP. You might be tempted to compile PHP3 yourself, but I don't think for general development purposes this is necessary. PHP also has mirror sites all over the world (it seems there are none in China). Select an image, find the download area, select "Source code and Windows distribution", and download "Windows Binary". You only need to Unzip the current file (WinZip is good) to a directory you like, such as C:PHP4B3. I recommend using the version number as the directory name, so that when you try a newer version in the future, you don’t need to delete the old one. Version.

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

3. Configure PHP

There is a Readme file in the file package distributed with PHP, which describes how to configure it. There is a file called PHP.INI-dist which is the main configuration file of PHP. Copy it to your Windows system directory (Windows for Windows 9x or WinNT for Windows NT) and rename it PHP.INI. This file needs to be modified appropriately. The most important thing is to add some modules that may be used, such as MySQL. Find the following section in the PHP.INI file:

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

; if you wish to have an extension loaded automatically, use the
; following syntax: extension=modulename.extension
; for example, on windows,
; extension=msql.dll ; or under UNIX,
; extension=msql.so
; Note that it should be the name of the module only,
; no directory information needs to go here.
; 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 convert the file Remove comments from some lines, that is, delete the leading semicolons. I need MySQL support myself, so I removed the semicolon ";" from the "extension=php3_mysql.dll" line. In certain cases, the DLL file you want to use is not in this list, you just need to simply add a line, For example: "extension=mydll.dll". In this way, PHP is configured.

4. Let Apache and PHP work together

Find the directory where you installed Apache in the first section, and use your favorite file editor (preferably one that supports Win32 long file name format, Such as Edit, Ultraedit, etc.) open the .confhttpd.conf file, in this case c: Apacheconfhttpd.conf (this is the main configuration file of APACHE, do not modify it easily unless you are certain). If you don't understand the content, you can read the Apache documentation. To make Apache work with PHP, you just need to 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"

Required Note that the above three lines cannot be written incorrectly. The last part of the first line is the directory where you installed PHP; you can copy and paste the next two lines directly from here. This line of configuration commands is case-sensitive.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/317021.htmlTechArticleProbably the most asked question on the PHP mailing list is: “How do I install PHP on my Windows machine? ”, then maybe I can help answer that question. When you have installed it correctly...
source:php.cn
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