Home > Development Tools > VSCode > body text

Can vscode debug PHP?

藏色散人
Release: 2019-11-08 10:48:01
Original
2772 people have browsed it

Can vscode debug PHP?

Can vscode debug PHP?

Use VS Code breakpoints to debug PHP

vs code uses an outstanding lightweight code editor with numerous and growing plug-in tools. Using vs code to debug PHP code is even more convenient and concise. Let’s take a look at it together.

Related recommendations: "vscode tutorial"

1. Install the XDebug extension

The most commonly used extension for debugging PHP code is the XDebug extension. First we need to Install this extension first.

Below I recommend a very convenient method to install the XDebug extension. First, create a new phpinfo file to obtain the contents of phpinfo, and copy them all into the input box in the XDebug detection URL, as shown in the figure below:

Can vscode debug PHP?

After a short wait, the website will analyze the most suitable xdebug version for your current PHP environment and provide a download link, as shown below:

Can vscode debug PHP?

After the download is completed, copy the file to the extension directory of php, that is, the ext folder in the installation directory.

2. Set up PHP to use XDebug

Add a line zend_extension=path/to/xdebug to the php.ini configuration file, where path/to/xdebug is the installation directory of xdebug plus the file name .

Now, look at the output of the phpinfo file again, and you should be able to see that xdebug is enabled.

3. Enable remote debugging

Add the xdebug configuration item in the php.ini configuration file:

[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
Copy after login

4. Add the VS Code extension

Search for the PHP Debug extension in vs code and install it.

The installation is complete. Now you can test it. Enable debugging in the debug interface of vs code and choose to add the configuration of xdebug.

Can vscode debug PHP?

You can add it below Keep it short, feel free to debug it.

The above is the detailed content of Can vscode debug PHP?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!