Install and configure Apache + PHP in Win9x/ME _ PHP

Source: Internet
Author: User
ApacheServer is one of the many WEB server software and has become one of the most popular web server software on the Internet. Compared with other web server software (such as PWS, IIS, and UNIX), Apache has the advantages of easy installation, simple configuration, and easy management. More importantly, it is free of charge like PHP! So I am favored by many friends.

Apache Server is one of the most popular WEB Server software on the Internet. Compared with other web server software (such as PWS, IIS, and UNIX), Apache has the advantages of easy installation, simple configuration, and easy management. More importantly, it is free of charge like PHP! So I have been favored BY many friends. next I will talk about how to install and configure Apache and PHP. come on, let's talk to me STEP BY STEP!

Step 1: Download Apache Server. The latest version of Apache Server in Apache official website (http://www.apache.org) can be found, in fact we do not need to go abroad to download, there are several domestic sites, such as http://phpuser.com, http://www.php.com.cn, http://www.phpchina.com have, download speed is quite fast! Download the self-decompressed installation file named apache_1_3_x_win32_r2.exe. Here, 1_3_x is the apache version. We use the latest version 1.3.14.

Step 2: install Apache Server. Like general software, the installation process is very simple. you just need to change its installation directory to [C: Apache] (), after the installation is complete, an [Apache Web Server] project is displayed in [start]-> [program] of win98. At this time, Apache Server is successfully installed. you can proceed !!




Step 3: Configure Apache Server. Configuration of Apache Server is a little troublesome, because Apache Server was originally running on UNIX and has many UNIX features, for example, its configuration requires a special configuration file (suffixed with conf. Earlier versions of Apache Server have three files: httpd. conf, srm. conf, and access. conf, which must be configured by the user. Now we do not need to configure all three files in the version we use. you only need to configure httpd. conf! The following are the most critical configurations. Use the [notepad] that comes with WIN98 to open the httpd. CONF file (C: Apacheconfhttpd. conf) in the [Apache] Directory under the C root directory ). This file is very long, but there are not many changes to it, and the structure of this file is not complex. it consists of the description statement and project configuration statement. The preceding "#" is a comment on this sentence. it indicates the statement and does not work. The other is the configuration statement. In the configuration statement, make the following changes:

1: Find ServerType (server type). Two of them are [standalone] and [inetd]. [standalone] listens to each connection with its own process, [inetd] starts the Apache process when it is connected. It is generally set to standalone, that is, this line is changed to ServerType standalone.

2: Find ServerRoot (the root directory of the Server), which is the installation directory of Apache Server. this line is changed:
ServerRoot "C: Apache"

3: Find the port (Server port), which is usually 80 by default. if there are other Web servers installed on your pc, you must separate them, for example, 80, one is 8080 !! Change to: port 80

4: Find ServerAdmin (server management). This is the email of the server administrator. If an error occurs on the server, the address is automatically added to the error page. you can ask him for help! This can also be left unchanged.

5: find ServerName (server name). This setting is very important. it is also the network ID of your computer, generally localhost. Of course, you can also customize it, but it must be the same as the one you wrote in the win98 network ID (). here it is changed:
ServerName localhost




6: find DocumentRoot (document root directory). here, the default home directory address is entered. that is, when http: // localhost/is entered in the address bar of IE browser, iewill automatically go to this directory to find the index.html file. Changed:

DocumentRoot "C:/Apache/htdocs" (note that the path must be enclosed in quotation marks)

7: find DirectoryIndex (default page). This default page is the screen displayed when localhost is entered in the address bar of IE browser. You can set multiple file extensions, such as .htm).html,. php, and. ph3. Here is changed:

DirectoryIndex index.html index.htm index. php3 index. php (note the space interval). after the change, change the file index.html.enunder C: apachehtdocsto index.html for IE to recognize.

8: find ScriptAlias (script alias). here is the Directory of the CGI program, changed:

ScriptAlias/cgi-bin/"C:/Apache/cgi-bin/" (note that the path must be enclosed in quotation marks)

So far, the configuration of Apache Server is basically complete. check whether the configuration is correct. Run Apache Server ([Start]-) [program]-) [Apache Web Server]-) [Start Apache]) first. After the operation is successful, a dos window () will pop up. if the window disappears immediately after the pop-up or the dos window content is not, it is likely that your 5th (ServerName) is not set. After running successfully, enter http: // localhost/in the address bar of IE browser. If yes, the screen should appear. This means that you have successfully configured the Apache server.





Step 4: install and configure PHP. PHP can go to http://www.php.com.cn to download get the latest version. We use version 4.04. the downloaded file is php-4.0.4-win32.zip and the size is 2.7 MB. Decompress it to C: PHP4 and the installation is complete.

Step 5: Configure PHP. Rename the file php. ini-inst under the C: PHP4 directory to php. ini and make the following changes:

1: Find DOC_ROOT =. It is the root directory of the server and changed:

DOC_ROOT = C: Apachehtdocs

2: Find extension_dir =./And change it:

Extension_dir = C: php4

After saving the disk, copy the file php. ini in the C: php4 directory to the C: windows directory.

Step 6: Apache Server and php can work. The last step is to make them work at the same time. Open the configuration file httpd. conf in the C: apacheconf directory and make the following changes:

1. find the first place where [<Directory>]... </Directory>] appears next to [DocumentRoot "C:/Apache/htdocs"] and change it:

<Directory "c:/php4">
Options FollowSymLinks
AllowOverride None
</Directory>

2: Add a few words at the end of this file, which means that Apache Server can recognize php applications. Add as follows:
ScriptAlias/php3/"c:/php4/" AddType application/x-httpd-php. php3. php. phtml. php4
Action application/x-httpd-php "/php4/php.exe"

Okay, so far, all the configuration work has been completed! It's not difficult to look back. Isn't it? Finally, check whether it is successful!

Compile a php program as follows:

<?
Print ("in win9X/me, I successfully configured Apache + php !!! ");
?>

Name this program test. php and save it in the C: apachehtdocs Directory. then open IE and enter http: // locahost/test in the address bar. if the screen appears, it will be done !!

  

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.