Apache server is one of the many Web server software that has become the most popular Web server software on the Internet. Compared to other Web server software (such as PWS, IIS, UNIX), Apache has the advantages of easy installation, simple configuration and easy management. More importantly, it's just as free as PHP! So by a lot of friends of the favor, I'll talk about how to install and configure Apache and PHP, come on, follow me step by step!
First step: Download Apache Server. The latest version of Apache server in the official Apache website (http://www.apache.org) can be found, in fact, we do not need to go abroad to download, there are several sites in the country, such as http://phpuser.com, http:// www.php.com.cn, http://www.phpchina.com, download speed is very fast! A self-extracting installation file with a generic file name of Apache_1_3_x_win32_r2.exe after downloading. Where 1_3_x is the version number of Apache, we are using the latest 1.3.14 version.
Step two: Install Apache Server. As with General software, the installation process is very simple, along the way [next], only to change its installation directory to [C:\Apache] (Figure 1), after the installation of the Win98 [start]-〉[program] will be more than [Apache Web Server] a project. At this time the Apache server installed successfully, you can next!!
Figure 1
Step three: Configure Apache Server. The Apache server configuration is a little bit of a hassle because Apache server was originally run on UNIX, with many UNIX features, such as its configuration requiring a dedicated configuration file (suffix named conf) to complete. Apache server has three files in its earlier version: Httpd.conf, srm.conf, and access.conf need to be configured by the user. Now we use the version does not need to the three files are configured, as long as the configuration httpd.conf on the line! The following are the most critical configurations. Use WIN98 to open the httpd.conf file (C:\Apache\conf\httpd.conf) in [CONF] under the [Apache] directory under the C packing directory. This file is very long, but we need to change the place is not a lot, and carefully look at the structure of this file is not complex, it is composed of statement statements and project configuration statements. Preceded by "#" is the comment on this sentence, is the description statement, does not work, the other is the configuration statement. In the configuration statement, you make the following changes:
1: Find ServerType (server type), two are [standalone] and [Inetd],[standalone] are using their own process to listen to each connection, and [inetd] is to start the Apache process when the connection arrives. Generally set to standalone, that is, this line is changed to: ServerType standalone
2: Locate the ServerRoot (server root directory), ServerRoot is the installation directory for Apache server, this line should read:
ServerRoot "C:\Apache"
3: Find port (server ports), generally by default is 80, if your PC also contains other web Server, it must be separated, such as a 80, a 8080 on it!! Instead: Port 80
4: Find serveradmin (server management), this is the server admin should be filled in e-mail. If the server generates an error, it automatically adds this address to the error page, and you can ask him for help! Here also can not change.
5: Find servername (server name), this setting is very important, she is your computer network identification, generally for localhost. Of course, it can be customized, but it must be the same as you write in the Win98 's network logo (Figure 2), here instead:
ServerName localhost
Figure 2
6: Find DocumentRoot (document Root), here is the default home directory address, that is, in the Internet Explorer's address bar input http://localhost/ie will automatically go to the directory below to find index.html files. To
DocumentRoot "C:/apache/htdocs" (note that the path must be enclosed in quotes)
7: Find the DirectoryIndex (default page), this default page is in the Internet Explorer address bar input localhost appear when the screen. You can set multiple file suffix names, such as. htm,. html,. php,. Ph3. Here instead:
DirectoryIndex index.html index.htm index.php3 index.php (note to use space interval), after the change will be C:\Apache\ Htdocs under the file Index.html.en changed to index.html, let IE browser recognition.
8: Find Scriptalias (script alias), here is the directory of the specified CGI program, instead:
scriptalias/cgi-bin/"c:/apache/cgi-bin/" (note that the path must be enclosed in quotes)
So far, Apache server configuration is basically complete, you can check the configuration is correct. Run Apache Server First ([Start]-) [Program]-] [Apache Web server]-] [start Apache]). After the success of the run will pop up a DOS window (Figure 3), if the pop-up immediately disappear or DOS window content is not Figure 3, then most likely your 5th (ServerName) did not set the right. After running successfully, enter http://localhost/in the address bar of IE browser, if correct should appear figure 4 picture. This means that you have successfully configured the Apache server.
Figure 3
Figure 4
Fourth Step: Install and configure PHP. PHP can go to the http://www.php.com.cn download to get the latest version. We are using the 4.04 version, after downloading the file for Php-4.0.4-win32.zip, the size of 2.7MB. Unzip it to the C:\PHP4 and the installation is over.
Fifth step: Configure PHP. Rename the file Php.ini-inst in 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 instead:
Doc_root=c:\apache\htdocs
2: Find extension_dir=./instead:
Extension_dir=c:\php4
Save the file exit and then copy the files in the C:\php4\ directory php.ini to the C:\windows directory.
The sixth step: 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 [DocumentRoot "C:/apache/htdocs"] the first time below [ ], change it to:
Options FollowSymLinks
AllowOverride None
2: Add a few words to the end of this file, which means that Apache server can identify the PHP application. Added as follows:
scriptalias/php3/"c:/php4/" AddType application/x-httpd-php. PhP3. php. phtml. PhP4
Action application/x-httpd-php "/php4/php.exe"
All right, so far, all the configuration work is done! It's not too hard to look back. Isn't it? Finally, check to see if it worked!
Edit a PHP program as follows:
?
Print ("Under the win9x/me I successfully configured the apache+php!!!");
? >
http://locahost/ Test
Figure 5