1. Download
|
|
vs Code |
https://go.microsoft.com/fwlink/? linkid=852157 |
apache2.4.33 |
https://www.apachelounge.com/download/VC14/binaries/httpd-2.4.33-win32-VC14.zip |
php7.1.19 |
Https://windows.php.net/downloads/releases/php-7.1.19-Win32-VC14-x86.zip |
vc_redist.x86 |
https://download.microsoft.com /download/9/3/f/93fcf1e7-e6a4-478b-96e7-d4b285925b00/vc_redist.x86.exe |
You can download different versions of Apache and PHP, and note that the two parts of Win32 and VC14 are consistent
https://www.apachelounge.com/download/
https://windows.php.net/download/
2. Install 2.1 PHP
Will php-7.1.19-Win32-VC14-x86.zip
unzip to the C drive (other disks can also), and change the folder named PHP
C:\php;C:\Apache24\bin;
Add to environment variable
Open C:\php
, php.ini-development
or rename php.ini-production
tophp.ini
2.2 Apache
Will httpd-2.4.33-win32-VC14.zip
unzip to the C drive and change the folder name to Apache24
Modifying a configuration file
"C:\Apache24\conf\httpd.conf"
"C:\Apache24\conf\httpd.conf"
Uncomment ServerName www.example.com:80
, and change toServerName localhost:80
Ensure that the path to the following configuration is correct
DocumentRoot "c:/Apache24/htdocs"<Directory "c:/Apache24/htdocs">ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"<Directory "c:/Apache24/cgi-bin">
Add to
LoadModule php7_module C:\php\php7apache2_4.dllPHPIniDir "C:\php\php.ini"AddType application/x-httpd-php .php .pap .phtml
Double clickhttpd.exe
The browser opens 127.0.0.1
, it works!
stating that Apache is running normally
Installation Services
C:\Apache24\bin> httpd -k install -n "Apache"
- Delete Service (administrator mode, two-way method)
sc delete service_namehttpd -k uninstall -n "Apache"
- Starting and shutting down services
net start Apachenet stop Apache
2.3 VS Code
1. Install PHP Debug
the plugin,PHP IntelliSense
2.File->Preference->Settings
To modify these three items, the path of PHP is modified to its own path
"php.executablePath": "c:/php/php.exe","php.validate.executablePath": "c:/php/php.exe","php.suggest.basic": false,
3. InstallationXDebug
Https://xdebug.org/files/php_xdebug-2.6.0-7.1-vc14.dll
Throw the downloaded DLL into the c:/php/ext
Modifyphp.ini
[xdebug]zend_extension = "C:\php\ext\php_xdebug-2.6.0-7.1-vc14.dll"xdebug.remote_enable = On;启用性能检测分析;xdebug.profiler_enable = On;启用代码自动跟踪xdebug.auto_trace=Onxdebug.profiler_enable_trigger = Onxdebug.profiler_output_name = cachegrind.out.%t.%p;指定性能分析文件的存放目录;xdebug.profiler_output_dir ="C:/wamp64/tmp"xdebug.show_local_vars=0;配置端口和监听的域名xdebug.remote_port=9000xdebug.remote_host="localhost"
The first time you run the project, selectPHP
will appear Listen for XDebug
,
Launch currently open script
Two modes of operation, select to be Listen for XDebug
able to debug
When debugging, if you cannot hit the breakpoint, you should think about whether the code at this point will be executed to
[PHP] php, Apache, VS code installation and configuration