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.
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
-
##Uninstall: Execute with administrator privileges under the bin directory of apache
httpd.exe -k uninstall
2. PHP
- Install and configure PHP
Note: The downloaded PHP VC version cannot be higher than the vc redist version installed previously.
Enter the PHP installation directory, copy a copy ofphp.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"
- Load PHP in Apache & define the file that executes the PHP module
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> #告诉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>
- Test: Create a new file under Apache installation path\htdocs: test.php , edit inside:, start Apache, enter in the browser: localhost:80/test.php.
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Notepad++7.3.1
Easy-to-use and free code editor

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Atom editor mac version download
The most popular open source editor
