Install and configure php in win7. Install and configure the three software used in the php installation instance under win7, you can download them directly from the official website. for convenience, you can also package and download them directly from your own CSDN resources. Install and configure php under Windows 7
The three software used in this installation instance can be downloaded directly from the official website. for convenience, you can also package and download them directly from your own CSDN resources.
Three installation files:
Www.Bkjia.com
To run a PHP website, you must install and configure three software: Apache, PHP, and MySQL. To edit and debug the PHP program, you must install an editing and debugging software.
I. Apache
Apache is a software similar to IIS and a program running on the server. it listens to port 80 by default. when receiving a request from port 80, it sends the required documents of the request to the client.
The request sending program runs in the browser of our client,
This means to connect Port 80 of the server that provides the blog service by CSDN and request the default. aspx under the yousuosi Directory of the server.
According to Baidu encyclopedia, when the Internet was just emerging, Apache was the first available Web application server program. it was widely used for its multi-platform, secure, open-source, and free services, apache is the world's top Web server software (which seems to be falling slowly). Apache is generally used to build PHP websites.
Install Apache under 32-bit Win7, 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 file, which is relatively simple to install. however, pay attention to some problems.
1. possible preparations
If IIS is installed on your machine, the two software listens to port 80 by default, which causes 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 Apache can also be modified ), of course, you can also stop the IIS website or even disable the IIS service (it is relatively simple to enable the IIS service on Win7). the specific operation steps are described on the Internet.
2. install and run the program:
3. welcome to the page. click Next to go to the Next step.
4. accept the license agreement and click Next to proceed.
5. read the relevant information and click Next to go to the Next step.
6. fill in the server information, which can be entered at will, without affecting installation. Note that there is an option to modify the default port, but we will not modify it here. Click Next to go to the Next step.
7. select M Custom installation and click Next to go to the Next step.
8. click the drop-down button before Apadche HTTPServer 2.2.25 and select the second item, that is, to install this item and all the sub-items (full installation ). Select and go to the next page.
9. here, we usually need to select the installation path and click Change to go to the interface:
10. here we choose to install it in the D: PHPApache Directory. after selecting the installation path, the interface is displayed:
11. click Next to go to the Next step.
12. confirm the preceding installation information and click Install to start installation. the installation interface is shown as follows:
13. after the installation is complete, check the installation content in D: PHPApache. Note that there is an index.html in the D: phpapachehtdocsfolder. this htdocs folder is equivalent to the wwwroot folder in IIS. by default, all website content is stored here.
14. Apache supports static website content. in the browser, enter http: // localhost or http: // localhost: 80 or http: // localhost: 80/index.html, you can view the following successfully installed test results.
II. basic configuration of Apache
The basic configuration of Apache is to change the root directory and default file of the website.
1. change the website root directory
The D: PHPApachehtdocs we just checked is the default website root directory of Apache. now we want to change it to D: PHPWeb, as follows:
(1) create a 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. You can also use notepad to find and open the file in the D: PHPApacheconf folder.
(3) search for the keyword "DocumentRoot" (that is, the website root directory). you can see the default configuration in row 180, as shown in:
Change the default configuration to "D:/PHP/Web", as shown in:
(4) in the same way, modify row 207th , Showing:
2. change the default file
Find "DirectoryIndex" and modify the content in row 242nd:
Metadata, index. php.
3. restart Apache
After Apache is successfully installed, the program running icon appears in the system tray, showing:
You can use this icon to start, stop, and restart the Apache service.
4. simple test:
Edit a simple htmfile index.htm in your notebook, as shown in the following figure:
Save the file to the D: PHP web folder and enter http: // localhost in the browser. The result is as follows:
The three software used in the installation instance can be downloaded directly from the official website. for convenience, you can also package and download them directly from your own CSDN resources. Three installations...