Dynamic web page creation tips PHP entry: What is Apache?

Source: Internet
Author: User
1. Apahce introduction according to the Web server investigation company Netcrafe (http://www.netcraft.co.uk/Survey/) survey, more than 50% of the Internet Web servers are using Apache. Apache and MsIIS belong to the same Web server. 2. install Apache (for Windows) 1. Introduction to Apahce

According to the Web Server Survey Company Netcrafe (http://www.netcraft.co.uk/Survey/) survey, more than 50% of all Internet Web servers are using Apache. Apache and Ms IIS belong to the same Web server.

II. install Apache (Windows version)

Decompress the downloaded file to a directory and run the Setup program. The installation process is displayed. For example, install it in a directory (c: \ apache. Then, under the word directory conf of this directory, there is a file named httpd. conf text file, compile it with the text editor, and change the line "# BindAddress *" to "BindAddress 127.0.0.1 ". Now, let's get started with running Apache. if you enter http: // 127.0.0.1 in your browser, you will see the consequences of the Apache server. It should be clarified that, if your local machine is already running another Web server, you can change it by correcting the port. you can go to httpd. change "Port 80" in the conf file to "Port 81" or another Port that does not run the service. In general, the FTP port is 21..., so you can enter "http: // 127.0.0.1: 81" in the browser.

Note: If the above step still does not work (the page cannot be displayed), you can put a line in the httpd. conf file:

# ServerName new. host. name

Changed:

ServerName localhost

3. set Apache virtual directory

In IIS and PWS, this setting is implemented through the graphical interface. in Apache, httpd is also compiled. conf file (note: this file should not be easily corrected), add a line in this file

Alias/test/'C:/php/test /'

Set the c:/php/test/directory to the virtual directory/test, you can visit the website by entering "http: // 127.0.0.1/test/file" in the browser.

4. support PHP with Apache

Now, the simple configuration of the Apache server is okay, but the following work is required to support PHP.

In the httpd. conf file, add the following lines:

ScriptAlias/php3/'C:/php3 /'
AddType application/x-httpd-php3. php
Action applications/x-httpd-php3 '/php3/php.exe'

Of course, if you want to change the suffix of your php file to another one, you can also change the last few words in the second line ". change php to the suffix you want. to support more files, you can also, for example:

ScriptAlias/php3/'C:/php3 /'
AddType application/x-httpd-php3. php
AddType application/x-httpd-php3. php3
AddType applications/x-httpd-php3. phtml
Action applications/x-httpd-php3 '/php3/php.exe'

Okay. restart the Apache server. let's see if it is successful.

Compile a simple php file (hello. php) in the test virtual directory ):

Echo 'Hello World! ';

?>

In the browser (http: // 127.0.0.1/test/hello. php) to see if it is successful?

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.