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] (Figure 1 ), 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 !!
Figure 1
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: \ Apache \ conf \ httpd. conf) in [conf] under 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 what you wrote in The win98 network ID (figure 2). Here it is changed:
ServerName localhost
Figure 2
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 index.html.ento index.html, the file under C: \ Apache \ htdocs, to be recognized by IE.
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 (Figure 3). If it disappears immediately after the pop-up or the dos window content is not shown in figure 3, it is likely your 5th (ServerName) no. After running successfully, enter http: // localhost/in the address bar of IE browser. If yes, figure 4 is displayed. This means that you have successfully configured the Apache server.
Figure 3
Figure 4
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 php. ini-inst file 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: \ Apache \ htdocs
2: Find extension_dir =./and change it:
Extension_dir = C: \ php4
After saving the disk, copy the php. ini file 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: \ apache \ conf 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 is saved in the C: \ apache \ htdocs directory, open IE, and enter http: // locahost/test in the address bar. If Figure 5 is displayed, the result is displayed !!
Figure 5