Dynamic Web Production Technology PHP Primer: What is Apache?

Source: Internet
Author: User
Tags iis php file php3 file
introduction of Apahce

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

Second, the Apache installation (refers to the Windows version)

Unzip the downloaded file into a directory, run the Setup program, will prompt the entire installation process. For example, install to a directory (c:\apache\). Then, there is a text file named httpd.conf in the directory's Word directory, and edit it with a text editor, changing the "#BindAddress *" line to "bindaddress 127.0.0.1". Well, it's so simple, start running Apache, and then you type in the browser: http://127.0.0.1 should see the Apache server's effect. It should be explained that if your native is already running a different Web server, you can make a difference by modifying the port, and you can change the "port 80" of the httpd.conf file to "Port 81" or other ports that are not running the service. Generally speaking, the FTP port is 21 ..., then, you can enter "http://127.0.0.1:81" on the browser.

Note: If you go through the steps above, or not (the page cannot be found), you can httpd.conf a line in the file:

#ServerName New.host.name

To

ServerName localhost

Three, set Apache virtual directory

In IIS and PWS, this setting is done through the graphical interface, in Apache, the same edit httpd.conf file (Note: The file is not easy to change), add a line to the file

alias/test/"c:/php/test/"

Indicates that the c:/php/test/directory is set to the virtual directory/test/, then the file you c:/php/test/under can be accessed by typing "http://127.0.0.1/test/file" in the browser.

Four, make Apache support PHP

Well, the simple configuration of the Apache server is OK, but to support PHP, you need to do the following.

Add the following lines to the httpd.conf file:

scriptalias/php3/"c:/php3/"
AddType application/x-httpd-php3. php
Action application/x-httpd-php3 "/php3/php.exe"

Of course, if you want to change your php file suffix to something else, you can change the last few words ". php" in the second line to the suffix you want, and you can support more files, such as:

scriptalias/php3/"c:/php3/"
AddType application/x-httpd-php3. php
AddType application/x-httpd-php3. php3
AddType application/x-httpd-php3. phtml
Action application/x-httpd-php3 "/php3/php.exe"

OK, restart the Apache server, let's see if there's any success.

Write one of the simplest PHP files (hello.php) under the test virtual directory:

?

echo "Hello world!";

?>

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

Okay, we'll use

? Phpinfo ()?>

Look at the configuration of PHP!

V. Database support

The best way to be a message board is definitely to manipulate the database. So, we're going to select a database support, here, I don't say everyone knows to choose MySQL, OK, the next section, I will introduce MySQL basics.

VI. SPECIAL TIPS!!!

The above is the Php3+apache+win98 setting

You can install PHP3 and PHP4 at the same time in one system, such as my current httpd.conf file configuration on my Win2000:
scriptalias/php4/"e:/php/php4/"
scriptalias/php3/"e:/php/php3/"
AddType application/x-httpd-php. PhP4
AddType application/x-httpd-php. php
AddType application/x-httpd-php3. php3
AddType application/x-httpd-php3. phtml
Action application/x-httpd-php "/php4/php.exe"
Action application/x-httpd-php3 "/php3/php.exe"
In My computer, PHP4 files are placed in the E:/PHP/PHP4 directory, php3 files under E:/php/php3, so that I visit. PhP4 and. PHP is PHP4 file, while access to. PhP3 and. phtml is the PHP3 file. I think we've seen this. , it should be more clear.



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.