debugging PHP with a vs code breakpoint

Source: Internet
Author: User

VS code uses an exceptional lightweight code editor with plug-in tools that are numerous and growing. Using vs code to debug PHP code is more convenient and concise, let's look at it together.

1. Installing the XDebug Extension

The most common use of debugging PHP code is the XDebug extension, first we need to install the extension tool first.
The following I recommend a very convenient way to install the XDebug extension, first create a new phpinfo file to get to phpinfo content, all copied to the XDebug detection URL in the input box, see:

After a moment, the site will analyze the most appropriate version of the Xdebug for your current PHP environment, and give the download link, see:

When the download is complete, copy the file to the extension directory in PHP, which is under the Ext folder in the installation directory.

2. Set PHP to use XDebug

Add a row to the php.ini configuration file zend_extension=path/to/xdebug , which path/to/xdebug is the Xdebug installation directory plus the file name.
Now, looking again at the contents of the Phpinfo file output, you should be able to see the xdebug enabled.

3. Enable remote debugging

Add the Xdebug configuration entry in the php.ini configuration file:

[XDebug]xdebug.remote_enable = 1xdebug.remote_autostart = 1
    • 1
    • 2
    • 3
4. Add a VS Code extension

Search for PHP Debug extensions and install in VS code.

The installation is complete, the following can be tested, in the debug interface of the VS code to open debugging, choose to add Xdebug configuration

Below, you can add a short point, debugging at will.

69692096

debugging PHP with a vs code breakpoint

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.