How to build a PHP environment on win7 local server: first install and configure Apache; then download PHP and configure php.ini; and finally restart the Apache server.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
Windows7 builds Apache local server PHP environment
Because Apache is in the win environment There is no release version provided below, only the source code. If you don’t want to compile it yourself, you can choose this version: https://www.apachelounge.com/download/
1. Download and extract to the installation directory d:\Apache24
2. Modify the configuration file d:\Apache24\conf
ServerRoot "d:\Apache24" DocumentRoot "d:\Apache24\htdocs" Directory "d:\Apache24\htdocs" ServerName localhost:80
Modify:
<Directory "d:/Apache24/htdocs"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
4. Enter localhost in the browser and display "It works!", success
1. Download and extract to the installation directory d:\php
2. Modify the Apache configuration file d:\Apache24\conf, Add the following code
# php7 supportLoadModule php7_module d:/php/php7apache2_4.dllAddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phpsPHPIniDir "D:/php/"
3. Modify
<IfModule dir_module> DirectoryIndex index.html index.php</IfModule>
4. Configure php.ini
5. Add index.php in the d:\Apache24\htdocs path and add:
<?phpphpinfo();?>
6. Save and close
1. Open cmd as administrator, refer to this answer on Zhihu
2. Enter d:\Apache24\bin, enter
httpd.exe -k install -n "Apache24"
3. Win R, enter services. msc, start the system service console, find Apache24, restart
4. Enter localhost/index.php in the browser, the following page will appear, done
Recommended study: "PHP Video Tutorial"
The above is the detailed content of How to set up a php environment in win7 local server. For more information, please follow other related articles on the PHP Chinese website!