Install and configure PHP under Win7

Source: Internet
Author: User
Tags iis interface net php and php and mysql php website win32 root directory

This installation example of the use of three software, can be directly downloaded from the official website, in order to facilitate, you can also directly from my CSDN resources package download.

Three installation files as illustrated:

Www.2cto.com

Run PHP site, the main need to install, configure three software, Apache, PHP and MySQL. If you need to edit the debug PHP program, install an edit debugging software.
First, Apache
Apache is a similar to IIS software, is running on the server side of a program, by default it listens to 80 ports, when receiving a 80-port request, it will be the request of the required documents sent to the client.
The requesting program is running in our client's browser, when we enter the browser for example: Http://blog.csdn.net/yousuosi, the full input should be http://blog.csdn.net:80/yousuosi/default.aspx,
This means connecting to the 80 port of the server that CSDN provides the blog service, requesting the default.aspx of the server Yousuosi directory.


According to Baidu Encyclopedia, when the Internet has just arisen, Apache is the first available Web application Server program, because of its multi-platform, security, open source, free to be widely used, Apache is the world's top ranked Web server software (seemingly, slowly falling), build PHP website, Apache is generally used.
32-bit Win7 to install Apache, we use Httpd-2.2.25-win32-x86-openssl-0.9.8y.msi, the official download address is:
http://www.apache.org/dist/httpd/binaries/win32/
This is an automatic installation file, installation is relatively simple, but, still need to pay attention to some problems.
1. Possible preparatory work
If you have IIS installed on your machine, this can cause conflicts because both software listens to 80 ports by default. There are many ways to solve this problem, the best way is to modify the default port of the IIS Web site (of course, you can also modify Apache), of course, you can stop the IIS Web site or even shut down the IIS service (Win7 on the IIS service is simpler), the specific steps on the Internet have a lot of introductions, here will not say.
2, the installation program to run as shown in the picture:

3, welcome interface, click Next to enter the next step

4, accept the license agreement, click Next to enter the next step

5, read the relevant information, click Next to enter the next step

6, fill in the server information, this information can be filled out at will, no impact on the installation. Note that there is an option to modify the default port, but we are not modifying it here. Click Next to go to the next step.

7. Choose Custom Installation, click Next, and go to the next step.

8, click the Apadche httpserver 2.2.25 before the Drop-down button, select the second item, that is, choose to install the item and all the subkeys (that is, fully installed). Select to enter the next interface.

9, here, we usually need to select the installation path, click Change, enter the interface such as the icon:

10, here we choose to install in the D:phpapache directory, select a good installation path after the interface as shown:

11, click Next to enter the next step.

12, confirm the previous installation information, click Install to start installation, installation interface such as the diagram:

13, after installation, you can look at the installation content in D:phpapache, note D:phpapachehtdocs folder has a index.html, this Htdocs folder is equivalent to IIS Wwwroot folder, the default site content is stored here.

14, at this point, Apache can support the content of static Web site, in the browser is input http://localhost or http://localhost:80 or http://localhost:80/index.html can see the following installation successful test results.


Two, the basic configuration of Apache
The basic configuration of Apache is primarily to change the site root and default files.
1, change the site root directory
The d:phpapachehtdocs we just looked at is the Apache default site root directory, now we're going to change it to D:phpweb, as follows:
(1) Create a new folder Web in d:php;
(2) "Start" → "All Programs" → "Apache HTTP server" "→" Configure apache server 2.2 "→" Configure apache server "→" Edit the Apache HTTPD Co NF Configuration File ", open profile httpd.conf. This file can also be found and opened directly in the folder d:phpapacheconf with Notepad.
(3) Find the keyword "DocumentRoot" (that is, the site root), you can see the default configuration in 180 rows, such as the diagram:

Change this default configuration to "D:/php/web", as shown here:

(4) In the same way, modify line No. 207 to , for example:

2, change the default file
Look for "DirectoryIndex" and modify the contents of the No. 242 line as shown here:

This allows the system to display index.html, index.htm, and index.php in the order of the left to right in the case where the browser address is entered only in the path and specifies the specific file.
3. Restart Apache
After the Apache installation is successful, the program running icon appears in the system tray, as shown in the diagram:

With this icon, you can start, stop, and restart the Apache service.
4. Simple test:
Edit a simple HTM document index.htm with Notepad, as shown in:

Save this file to the D:phpweb folder and enter http://localhost in the browser, as shown:



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.