VSCode+xampp builds PHP development environment

One: Install the integrated software package

1. Download XAMPP   
Download address: http://xiazai.zol.com.cn/detail/38/372445.shtml

2. Installation:

All the way to next, the installation address is best not to choose the C drive, the author installed the English version, and the installation was successful

 Open it according to the demand. If I write PHP, I choose to open Apache.

3. Configure environment variables

Add the path of the folder where PHP.exe is located (the author's is "D:\soft\xampp\php") into the environment variable-system variable-Path

 4. Check whether the xampp configuration is successful

Execute php -v in cmd

2. Download and install the PHP debugging plugin--xdebug plugin

 1. Download xdebug

 Download address: https://xdebug.org/download

What PHP version to download can be seen in readme_de.txt in XAMPP

My version number is:

 It can be seen that the author's version is 8.1.2 and it is a thread safe version, so when downloading the xdebug plug-in, select

 Both php 8.1 VS16 (64bit) and php 8.1 VS16 TS (64) were downloaded, and it was found that the latter matched the thread-safe xampp version, so the latter was used

2. Add configuration

Copy the downloaded x-debug file (php_xdebug-2.9.7-7.4-vc15-x86_64.dll) to the php\ext folder,
modify the php.ini file with Notepad, add a few lines of configuration information at the end of the file, and save it . The port number in the ini file is consistent with the version number of launch.json

 

3. Download and install VSCode

1. Download VSCode

 Download address: https://code.visualstudio.com/

2. Install the debugging plugin in VSCode

Click the extension bar, enter PHP, and select PHP Debug to install.

3. Configure the PHP executable file path

Click File-Preferences-Settings of VSCode (different versions may display differently, pay attention to find user settings), find php in the extension in the settings, click setting.json to add the following line of configuration:

 open the file, append

4. Configure Debug

The default launch.json is fine and does not need to be changed.

 

 

Guess you like

Origin blog.csdn.net/weixin_48363639/article/details/123118064