Home > Backend Development > PHP Tutorial > Installation and configuration of php_PHP tutorial under win7

Installation and configuration of php_PHP tutorial under win7

WBOY
Release: 2016-07-13 10:02:40
Original
1032 people have browsed it

Installation and configuration of php under win7

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

The three installation files are as shown in the figure:

Installation and configuration of php_PHP tutorial under win7

www.Bkjia.com

To run a PHP website, you mainly need to install and configure three software, Apache, PHP and MySQL. If you need to edit and debug PHP programs, you must also install editing and debugging software.
1. Apache
Apache is a software similar to IIS. It is a program running on the server side. By default, it listens to port 80. When it receives a request from port 80, it will send the requested document to the client.
The program that makes the request is the browser running on our client. When we enter on the browser, for example: http://blog.csdn.net/yousuosi, the complete input should be http://blog.csdn.net :80/yousuosi/default.aspx,
This means connecting to port 80 of the server where CSDN provides blog services and requesting the default.aspx in the yousuosi directory of the server.


According to Baidu Encyclopedia, when the Internet just emerged, Apache was the first available Web application server program. Because it is multi-platform, secure, open source, and free and widely used, Apache is the world's No. 1 Web server software (seems like , slowly declining), to build PHP websites, Apache is generally used.
To install Apache under 32-bit Win7, 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, which is relatively simple to install. However, you still need to pay attention to some issues.
1. Possible preparations
If IIS is installed on your machine, since both software listen to port 80 by default, this will cause a conflict. There are many ways to solve this problem. The best way is to modify the default port of the IIS website (of course you can also modify Apache). Of course, you can also stop the IIS website or even close the IIS service (it is easier to enable the IIS service on Win7). There are many introductions to the specific operation steps online, so I won’t go into them here.
2. The installation program runs as shown in the figure:

Installation and configuration of php_PHP tutorial under win7

3. Welcome interface, click Next to proceed to the next step

Installation and configuration of php_PHP tutorial under win7

4. Accept the license agreement and click Next to proceed to the next step

Installation and configuration of php_PHP tutorial under win7

5. Read the relevant information and click Next to proceed to the next step

Installation and configuration of php_PHP tutorial under win7

6. Fill in the server information. You can fill in the information at will and will have no impact on the installation. Note that there is an option here to modify the default port, but we will not modify it here. Click Next to proceed to the next step.

Installation and configuration of php_PHP tutorial under win7

7. Select Custom installation and click Next to proceed to the next step.

Installation and configuration of php_PHP tutorial under win7

8. Click the drop-down button in front of Apadche HTTPServer 2.2.25 and select the second item, that is, choose to install this item and all sub-items (that is, complete installation). After selection, enter the next interface.

Installation and configuration of php_PHP tutorial under win7

9. Here, we usually need to select the installation path, click Change, and enter the interface as shown:

Installation and configuration of php_PHP tutorial under win7

10. Here we choose to install it in the D:PHPApache directory. After selecting the installation path, the interface is as shown below:

Installation and configuration of php_PHP tutorial under win7

11. Click Next to proceed to the next step.

Installation and configuration of php_PHP tutorial under win7

12. Confirm the previous installation information and click Install to start the installation. The installation interface is as shown in the figure:

Installation and configuration of php_PHP tutorial under win7

13. After the installation is completed, you can check the installation content in D:PHPApache. Note that there is index.html in the htdocs folder of D:PHPApache. This htdocs folder is equivalent to the wwwroot folder of IIS, where the default website content is stored. Here it is.

Installation and configuration of php_PHP tutorial under win7

14. At this time, Apache can fully support the content of static websites. You can enter http://localhost or http://localhost:80 or http://localhost:80/index.html in the browser. View the following test results of successful installation.

Installation and configuration of php_PHP tutorial under win7


2. Basic configuration of Apache
The basic configuration of Apache mainly involves changing the website root directory and default files.
1. Change the website root directory
The D:PHPApachehtdocs we just checked is the default website root directory of Apache. Now we need to change it to D:PHPWeb. 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 conf Configuration file", open the configuration file httpd.conf. This can be a file, or you can directly use Notepad to find and open it in the folder D:PHPApacheconf.
(3) Search for the keyword "DocumentRoot" (that is, the website root directory). You can see the default configuration on line 180, as shown in the picture:

Installation and configuration of php_PHP tutorial under win7

Change this default configuration to "D:/PHP/Web", as shown in the picture:

Installation and configuration of php_PHP tutorial under win7

(4) In the same way, change line 207 to , as shown in the figure:

Installation and configuration of php_PHP tutorial under win7

2. Change default file
Find "DirectoryIndex" and modify the content on line 242 as shown:

Installation and configuration of php_PHP tutorial under win7

In this way, when only the path is entered in the browser address and a specific file is specified, the system will prioritize displaying index.html, index.htm, and index.php in order from left to right.
3. Restart Apache
After Apache is installed successfully, the icon of the program running will appear in the system tray, as shown in the picture:

Installation and configuration of php_PHP tutorial under win7

Through 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 the figure:

Installation and configuration of php_PHP tutorial under win7

Save this file to the D:PHPWeb folder, enter http://localhost in the browser, the result is as shown in the figure:

Installation and configuration of php_PHP tutorial under win7

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/969603.htmlTechArticleInstallation and configuration of php under win7 The three software used in this installation example can be downloaded directly from the official website. For convenience, you can also package and download it directly from my CSDN resources. Three installations...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template