search
HomeBackend DevelopmentPHP TutorialHow to configure the PHP development environment under Windows 10 system

  • Build under Windows (Apache+PHP+MySQL) =>WAMP

  • Build under Linux (Apache+PHP+MySQL) => ;LAMP

PHP development environment configuration generally has two methods: kit installation and custom installation. Kits can also be found online, and you can directly download a complete development environment, eliminating the configuration process. However, this method is not flexible enough, and we cannot understand the relationship. It is still beneficial to try to configure the environment yourself. Yes, what I introduce in detail below is the custom installation of PHP development environment under Windows 10 system.

It is recommended to install these software into the same folder for easy management. I put them all in the

phpenvir folder; in addition, after each software is installed, test it Whether the installation is successful.

My next installation sequence is:

Apache→PHP→MySQL

Apache installation

Official website download link: Click here to download

How to configure the PHP development environment under Windows 10 system

There are several download links below, you can choose by yourself. I chose the second method to download.

How to configure the PHP development environment under Windows 10 system

Choose 32-bit or 64-bit according to your computer configuration. After the download is complete, unzip the file. Next, open the decompressed file, find the

http.conf file in the conf directory, and use a text compiler (such as Editplus) to open it, Ctrl+F

ServerRoot "C:/Apache24"
Change the file directory address to your installation location. For example, I installed it to the following location:

How to configure the PHP development environment under Windows 10 system

So I should change it here Change it to:

D:/phpenvir/Apache2.4.25
One thing to note here: the directory slash symbol should be

/ or \\.

Continue

Crtl+F in the file and find the following code:

#
DocumentRoot "c:/Apache24/htdocs"
<directory>
#</directory>
Same as above, modify it according to your own installation location:

#
DocumentRoot "D:/phpenvir/Apache2.4.25/htdocs"
<directory>
#</directory>
After modification

Save the file.

Next, use

administrator identity (Be sure to note here, you need to run it through the administrator identity. An error occurred here when you first started configuring, resulting in If an error occurs) open the command prompt, switch to the bin directory under the Apache directory, and execute the installation program httpd -k install.

How to configure the PHP development environment under Windows 10 system

It will prompt you that the Apache service is successfully installed. Then enter

httpd –k start to start the Apache service.

Test: Enter: http://localhost in the browser. If the page below appears, it means that Apache is installed successfully.

How to configure the PHP development environment under Windows 10 system

Tips:

  • After switching to the

    Apache directory## In the process of #bin folder, you can use the method mentioned above. In addition, you can also open the location where the bin file is located locally, and then hold down shift## Click the right mouse button while holding the # key, there will be an item in the list Open the command window here, click to open the command prompt, you can directly locate the location, eliminating the need to switch folders. As shown in the picture below:

How to configure the PHP development environment under Windows 10 system

The reason why we open the command prompt is where the
    bin folder
  • is located symbol because our

    httpd command is located in this folder. If you want to run our httpd command in any directory (that is, you do not need to switch to bin directory to operate), then we need to set the environment variable, the specific process is as follows:

Right-click
    Computer
  1. Properties (or shortcut key

    Win+PauseBreak) to open Computer SystemInterface

    Open the interface
  2. Change Settings
  3. Open
  4. Advanced
  5. Environment Variables# #Open

    PATH
  6. in System Variables

    #Add
  7. environment variable to install the complete bin directory of Apache Fill it in, and then
  8. confirm

    the open windows one by one (as you can see from the picture, the environment variables in the win10 operating system are arranged in rows, while win7Environment variables in the operating system seem to be all on one line, so when configuring environment variables, you should add ; at the end to distinguish different environment variables). Please refer to the picture below for details:

    How to configure the PHP development environment under Windows 10 system

    PHP安装

    Apache安装好之后,在下载PHP开发软件之前,先向httpd.conf文件中写入PHP支持模块。
    打开httpd.conf文件, Crtl+F

    DirectoryIndex index.html

    将其修改为

    #修改首页面文件类型支持
    DirectoryIndex index.html index.htm index.php

    然后,在文件尾部添加下面的内容:

    #让Apache支持PHP
    LoadModule php7_module "D:/phpenvir/php7.1.1/php7apache2_4.dll" 
    #告诉Apache php.ini的位置
    PHPIniDir  "D:/phpenvir/php7.1.1"   
    AddType application/x-httpd-php .php .html .htm

    写好之后保存文件。

    注意一点,上面添加的内容需要根据自己接下来将要安装的PHP软件版本进行修改,我这里安装的PHP7.1.1版本和Apache2.4.25版本,要确保能够在下载好的PHP文件夹中找到D:/phpenvir/php7.1.1/php7apache2_4.dllD:/phpenvir/php7.1.1/php.ini这两个文件,而php.ini文件是从php.ini-development文件复制而来的,下文会提及到.

    How to configure the PHP development environment under Windows 10 system

    接下来,开始下载PHP开发工具。

    请前往官网下载

    How to configure the PHP development environment under Windows 10 system

    从图中可以看到有Non Thread SafeThread Safe两个版本,我们需要下载Thread Safe的PHP环境。

    How to configure the PHP development environment under Windows 10 system

    下载完成之后将其解压到之前指定好的文件夹D:/phpenvir/php7.1.1中。

    然后,将php7.1.1目录下的php.ini-development文件重命名为php.ini,用Editplus打开,Crtl+F

    ;extension_dir="ext"

    将其修改为:

    #去掉前面的分号,并且将地址更改为自己的安装位置
    extension_dir="D:/phpenvir/php7.1.1/ext"

    接着Crtl+F

    ;extension=php_mysqli.dll  
    #将前面的分号去掉,这样PHP便可以支持mysqli扩展

    根据开发的不同需求,可以去掉各种扩展前面的分号,我们这里先去掉一些能用得到的(前面不带分号的即为自己启用的扩展):

    ;extension=php_bz2.dll 
    extension=php_curl.dll
    ;extension=php_fileinfo.dll
    ;extension=php_ftp.dll 
    extension=php_gd2.dll
    ;extension=php_gettext.dll
    ;extension=php_gmp.dll
    ;extension=php_intl.dll
    ;extension=php_imap.dll
    ;extension=php_interbase.dll
    ;extension=php_ldap.dll
    extension=php_mbstring.dll
    ;extension=php_exif.dll      ; Must be after mbstring as it depends on it
    extension=php_mysqli.dll
    ;extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client
    ;extension=php_openssl.dll
    ;extension=php_pdo_firebird.dll
    ;extension=php_pdo_mysql.dll
    ;extension=php_pdo_oci.dll
    ;extension=php_pdo_odbc.dll
    ;extension=php_pdo_pgsql.dll
    ;extension=php_pdo_sqlite.dll
    ;extension=php_pgsql.dll
    ;extension=php_shmop.dll

    测试

    在Apache目录下的htdocs文件夹中新建Index.php文件,填入以下代码:

    php
    <?php     phpinfo();
    ?>

    保存之后,在浏览器中输入:http://localhost/index.php
    如果出现如下页面,则证明PHP安装成功。

    How to configure the PHP development environment under Windows 10 system

    从上面这个页面中,你可以很清楚地看到自己安装的PHP版本Apache版本信息,包括各种扩展功能。

    MySQL安装

    请前往官网下载

    How to configure the PHP development environment under Windows 10 system

    How to configure the PHP development environment under Windows 10 system

    这里有两个版本msizip.
    msi格式的是我们平时经常使用的那种,可以直接点击安装,按照给出的提示进行安装。而Zip格式的则需要自己去解压,然后使用命令行进行相关配置,才能够使用。

    我个人下载安装的是msi格式的,安装方式比较简单,根据提示一步步安装即可,下面有两个教程对于MySQL安装已经解释得很清楚,这里我便不再多做赘述。

    将MySQL安装完成以后,PHP环境配置就大致完成了,需要注意的一点是平时写的php文件要放在Apache目录下的htdocs文件夹下,例如我这里是D:/phpenvir/Apache2.4.25/htdocs文件夹。如果想要自定义一个存放文件夹,还需要在httpd.conf中进行修改,具体操作可以去参考网上的方法。

The above is the detailed content of How to configure the PHP development environment under Windows 10 system. For more information, please follow other related articles on the PHP Chinese website!

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

How does PHP handle object cloning (clone keyword) and the __clone magic method?How does PHP handle object cloning (clone keyword) and the __clone magic method?Apr 17, 2025 am 12:24 AM

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP vs. Python: Use Cases and ApplicationsPHP vs. Python: Use Cases and ApplicationsApr 17, 2025 am 12:23 AM

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

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

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)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

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.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor