Table of Contents
Install PHP under Windows Development environment" >Install PHP under Windows Development environment
Home Backend Development PHP Problem How to install php environment under windows

How to install php environment under windows

Sep 28, 2021 pm 05:01 PM
php windows

Installation method: 1. Install and configure Apache; 2. Download and unzip the php installation package to the specified path; 3. Copy a copy of "php.ini-development" and rename it to "php.ini" for installation. path, configure the file; 4. Load PHP in Apache and define the file for executing the PHP module.

How to install php environment under windows

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

Install PHP under Windows Development environment

1. Apache

Because the Apache official website only provides source code, you must compile it yourself if you want to use it , here I choose the third-party installation package Apache Lounge.

  • Enter Apachelounge official download address: http://www.apachelounge.com/download/

  • First download and install vc redist, this It is a component necessary for Apache to run.

  • Download the decompressed version of Apache and place the decompressed folder in the path you want to install.

  • Modify the configuration file:

Apache’s default path is: c:\Apache24 (the version number may be different) . If it is different from your installation path, you need to open the Apach\conf\httpd.conf configuration file and change all c:\Apache24 and c:\Apache24 that are not commented with "#" in front of it. \htdocs and c:\Apache24\cgi-bin\ are changed to the corresponding paths.

Specify IP and port: Find ServerName www.example.com:80 in httpd.conf, remove the previous comment, and replace "www.example.com "changed to "localhost". If you want to modify the port, modify the "80" here together with the 80 in the previous "Listen: 80".

  • (Optional) Add system variables: Add "Apache installation path\bin" to Path.

  • Verify that the installation is successful: run Apache startup httpd.exe. Enter localhost:80 on the browser. If it is not inaccessible, then the Apache configuration is complete.

Tips: Register Apache as a Windows service

  • Install: apache’s bin directory Execute with administrator privileges

      httpd.exe -k install
    Copy after login
  • ##Uninstall: Execute with administrator privileges under the bin directory of apache

      httpd.exe -k uninstall
    Copy after login

2. PHP

  • Install and configure PHP
Enter the PHP download address http://windows. php.net/download Download the latest thread-safe version of PHP zip package, decompress it and place it in the path you want to install.

Note: The downloaded PHP VC version cannot be higher than the vc redist version installed previously.

Enter the PHP installation directory, copy a copy of

php.ini-development and rename it php.ini Place it in the installation path, open it and find ;extension_dir= ext, remove the comments and change the value to PHP installation path\ext.

    extension_dir = "D:/Program Files/php-7.2.10/ext"
Copy after login
  • Load PHP in Apache & define the file that executes the PHP module
Open the Apache configuration file conf\httpd.conf and find LoadModule Area, add after it:

           

LoadModule php7_module "PHP installation path\php7apache2_4.dll" # Load PHP as a module in Apache, the "7" in "php7_module" must be Corresponds to the PHP version; in addition, different PHP versions "php7apache2_4.dll" may be different.

       

PHPIniDir "PHP installation path" #Tell Apache the installation path of PHP

            # 在Apache中以module的方式加载PHP,“php7_module”中的“7”要和PHP的版本对应;此外,不同的PHP版本“php7apache2_4.dll”可能不同。
            #php  7.2.10
            LoadModule  php7_module 'D:/Program Files/php-7.2.10/php7apache2_4.dll' 
            <IfModule php7_module>
                    #告诉Apache PHP的安装路径
                    PHPIniDir 'D:/Program Files/php-7.2.10/php.ini'        
                    # define php  module file .php和.html的文件能执行PHP程序
                    AddType application/x-httpd-php .php .html
                    #AddType application/x-httpd-php-source .phps
            </IfModule>
Copy after login
    Test: Create a new file under Apache installation path\htdocs: test.php , edit inside:, start Apache, enter in the browser: localhost:80/test.php.
Recommended learning: "

PHP Video Tutorial"

The above is the detailed content of How to install php environment under windows. For more information, please follow other related articles on the PHP Chinese website!

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

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months 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)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated? How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated? Feb 21, 2025 pm 10:54 PM

The way to update ByBit exchanges varies by platform and device: Mobile: Check for updates and install in the app store. Desktop Client: Check for updates in the Help menu and install automatically. Web page: You need to manually access the official website for updates. Failure to update the exchange can lead to security vulnerabilities, functional limitations, compatibility issues and reduced transaction execution efficiency.

deepseek web version entrance deepseek official website entrance deepseek web version entrance deepseek official website entrance Feb 19, 2025 pm 04:54 PM

DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Mar 05, 2025 pm 05:57 PM

Detailed explanation and installation guide for PiNetwork nodes This article will introduce the PiNetwork ecosystem in detail - Pi nodes, a key role in the PiNetwork ecosystem, and provide complete steps for installation and configuration. After the launch of the PiNetwork blockchain test network, Pi nodes have become an important part of many pioneers actively participating in the testing, preparing for the upcoming main network release. If you don’t know PiNetwork yet, please refer to what is Picoin? What is the price for listing? Pi usage, mining and security analysis. What is PiNetwork? The PiNetwork project started in 2019 and owns its exclusive cryptocurrency Pi Coin. The project aims to create a one that everyone can participate

How to install deepseek How to install deepseek Feb 19, 2025 pm 05:48 PM

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Coinsuper exchange software channel official website entrance Coinsuper exchange software channel official website entrance Feb 21, 2025 pm 10:39 PM

The official website entrance of the Coinsuper Exchange: https://www.coinsuper.com. The client download channels are: Windows client, macOS client, and mobile (iOS/Android). Registration requires an email, mobile phone number and password, and you need to complete real-name authentication before you can trade. The platform provides a variety of digital asset transactions, including Bitcoin, Ethereum, etc., with the transaction fee rate of 0.1% for both orders and acceptors. Security safeguards include cold wallet storage, dual-factor verification, anti-money laundering and anti-terrorism financing measures, and with security public

See all articles