search
HomeBackend DevelopmentPHP TutorialInstallation and configuration of php_PHP tutorial under win7

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
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
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

PHP and Python are both high-level programming languages ​​that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

See all articles

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

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment