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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

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)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

Build a React App With a Laravel Back End: Part 2, React Build a React App With a Laravel Back End: Part 2, React Mar 04, 2025 am 09:33 AM

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Notifications in Laravel Notifications in Laravel Mar 04, 2025 am 09:22 AM

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov

Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP Logging: Best Practices for PHP Log Analysis PHP Logging: Best Practices for PHP Log Analysis Mar 10, 2025 pm 02:32 PM

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

See all articles