PHP + Apache + MySQL classic match, create environment 2 Apache Web Server Installation (reproduced and modified)

Source: Internet
Author: User
Install Apache on Apache Web Server

Apache official: http://httpd.apache.org/download.cgi

Download the Win32-x86 installation package such as: httpd-2.2.15-win32-x86-no_ssl.msi. (Download this address directly: http://www.fayea.com/apache-mirror//httpd/binaries/win32/httpd-2.2.22-win32-x86-no_ssl.msi I tried a few other, it seems that some problems)

After obtaining the installation package, double-click the installation package to run the installation file.ProgramThe directory is C: Program filesapache groupapache2.

Apache configuration

After the installation is complete, use a text editor to open the configuration file httpd. conf In the conf folder under the Apache installation path. Unlike PHP. ini, the "#" symbol in front of the configuration file indicates that the configuration item does not take effect.

The items to be modified in the configuration file include:

1. Support for PHP parsing:

Find the "# PHP for Apache in module" section and add (or change to) the following Configuration:

Loadmodule php5_module E:/PhP5/php5apache2. dlladdtype application/X-httpd-PHP. php

Ii. Change the default resolution directory:

Search for the keyword "# DocumentRoot" and add (or change to) the following Configuration:

 
DocumentRoot "E:/html"

Not far from the following, there is such a line: # This shoshould be changed to whatever you set DocumentRoot

Change <directory "C:/***"> to the corresponding directory Configuration:

 
<Directory "E:/html">

Note: You can change the Apache resolution path to your actual resolution path based on your actual situation.

After completing the preceding two configuration items, click Start> program> Apache HTTP Server 2.2.15 to start the Apache Web service or restart the Apache Web Service for the configuration to take effect.

Prompt

Any changes to PhP. ini and httpd. conf must be restarted to make the changes take effect. (Restart the service by starting from> program> Apache HTTP Server 2.2> Control Apache Server> restart or stop the service.)

Test Web Services

Open your browser and enter http: // 127.0.0.1/in the address bar. After you press enter, the website homepage we designed in the XHTML section is displayed. If the path you direct to does not contain any files, you can simply edit a file named index.html and put it in the directory to test.

Test PHP support

Open the editor, create a PHP file, and typeCode:

 
<? Phpphpinfo ();?>

Save the file to the E:/html folder and name it phpinfo. php. Enter http: // 127.0.0.1/phpinfo. php in the address bar of the browser to access the file. The PHP system information is displayed on the browser page.

PHP system information page example: Click to view

Note: The PHP system information page varies slightly with the system. If this page is available, it indicates that you have successfully configured Apache to support PHP. If you are prompted to download the phpinfo. php file, the httpd. conf configuration is faulty. You need to check the configuration and restart the Apache web service.

Other configuration options

Some configuration options in httpd. conf:

 
Listen 80 # listening port directoryindex index.html index. php (In this step, the apacheserver will automatically search for the index.html or index. php file in this folder, then open and execute it.)
Related Article

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.