Table of Contents
Installation and configuration of php under win7
Home Backend Development PHP Tutorial Installation and configuration of php_PHP tutorial under win7

Installation and configuration of php_PHP tutorial under win7

Jul 13, 2016 am 10:02 AM

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...
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

How does session hijacking work and how can you mitigate it in PHP? How does session hijacking work and how can you mitigate it in PHP? Apr 06, 2025 am 12:02 AM

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

Describe the SOLID principles and how they apply to PHP development. Describe the SOLID principles and how they apply to PHP development. Apr 03, 2025 am 12:04 AM

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to debug CLI mode in PHPStorm? How to debug CLI mode in PHPStorm? Apr 01, 2025 pm 02:57 PM

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

How to automatically set permissions of unixsocket after system restart? How to automatically set permissions of unixsocket after system restart? Mar 31, 2025 pm 11:54 PM

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

How to send a POST request containing JSON data using PHP's cURL library? How to send a POST request containing JSON data using PHP's cURL library? Apr 01, 2025 pm 03:12 PM

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

See all articles