Installing and configuring PHP under Win7

Source: Internet
Author: User

The installation example used in the three software, can be directly downloaded from the official website, for convenience, you can also directly from my CSDN resources package download.

Three installation files are shown:

CSDN High Speed:

http://download.csdn.net/detail/yousuosi/5811053

To run a PHP Web site, you need to install and configure three software, Apache, PHP, and MySQL. If you need to edit the debug PHP program, also install an editing debugging software.
First, Apache
Apache is a software similar to IIS, is run on the server side of a program, by default it listens to 80 port, when receiving a 80 port request, it will send the requested document to the client.
This request program is run in our client browser, when we enter on the browser for example: Http://blog.csdn.net/yousuosi, the full input should be http://blog.csdn.net:80/yousuosi/default.aspx,
It means to connect the 80 port of the server that CSDN provides the blog service and request the Default.aspx under the Yousuosi directory of the server.


According to Baidu Encyclopedia, when the internet has just emerged, Apache is the first available Web application Server program, due to its multi-platform, security, open source, free to be widely used, Apache is the world's first use of the Web server software (seemingly, slowly declining), build PHP website, Apache is generally used.
32-bit Win7 under install Apache, we use Httpd-2.2.25-win32-x86-openssl-0.9.8y.msi, the official is:
http://www.apache.org/dist/httpd/binaries/win32/
This is an automatic installation of files, 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, because both software listens on port 80 by default, this can cause conflicts. There are many ways to solve this problem, the best way is to modify the IIS Web site's default port (of course, you can also modify Apache), of course, you can also stop the IIS Web site or even shut down the IIS service (Win7 on the IIS service is relatively simple), specific steps on the internet there are many introductions, here is no longer said.
2, the installation program run up:

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

4. Accept the License agreement and click Next to proceed to 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, no impact on the installation. Note that there is an option to modify the default port, however, we do not modify it here. Click nextto proceed to the next step.

7, select Custom installation, click Next, go to the next step.

8, click apadche httpserver 2.2.25 Front of the drop-down button, select the second option, that is, choose to install the item and all children (that is, the full installation). Select to go to the next screen.

9, here, we usually need to select the installation path, Click Change, enter the interface shown:

Here we choose to install in the D:\PHP\Apache directory, choose a good installation path after the interface shown:

Click Next to proceed to the next step.

confirm the previous installation information, click Install to start the installation, the installation interface is as follows:

After the installation is complete, you can check the installation contents in D:\PHP\Apache , note that there is a index.htmlin the D:\PHP\Apache\htdocs folder, This htdocs folder is equivalent to the IIS wwwroot folder, where the default Web content is stored.

at this time,Apache can fully support the content of the static website, in the browser is input http://localhost or http://localhost:80 or http://localhost:80/index.html can see the following successful test results for installation.


Second, 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
Just now we looked at the D:\PHP\Apache\htdocs is the Apache Default Web site root directory, we want to change it to D:\PHP\Web, the steps are 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 the profile httpd.conf. This file can also be found and opened directly in the folder D:\PHP\Apache\conf\ with Notepad.
(3) Find the keyword "DocumentRoot" (that is, the Web site root directory), you can see the default configuration in 180 lines, as shown:

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

(4) In the same vein, the NO. 207 line is modified to <directory "D:/php/web", showing:

2. Change the default file
Look for "DirectoryIndex" and modify the contents of the No. 242 line as follows:

In this way, index.html, index.htm, index.php are prioritized in the left-to-right order, in cases where the browser address only enters the path and specifies the specific file.
3. Restart Apache
Once the Apache installation is successful, the program running icon appears in the system tray, as shown in:

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

Save this file to the D:\PHP\Web folder, enter http://localhost in the browser, and the results are as follows:

Installing and configuring PHP under Win7

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.