Visual Studio Code debugging PHP Method Tutorial

Source: Internet
Author: User
Tags php download
This article mainly introduces the Visual Studio Code debugging PHP method (graphic detailed), with a certain reference value, interested can understand

Brief introduction

PHP is a dynamic language without a debugger, it is troublesome to get out of the wrong line. Vscode can be said to be the gospel of programmers, starting fast, plugins more and more, cross-platform. Now, let's talk about Vscode. debugging PHP Files

Required Documents

    • XAMPP Integration Server

    • Vscode

    • Xdebug

    • Php-debug Plug-in

1: Press F1 in Vscode, enter ext install php-debug install debug plugin

2: Go to https://xdebug.org/download.php download PHP corresponding version of the plugin, PHP version can be seen in the XAMPP readme, download this PHP 5.6 VC11 TS (+ bit) copy the DLL files to the PHP directory

3: Open PHP directory php.ini, add a few lines of configuration, xdebug the path according to the actual situation configuration, configure the completion of the Apache server restart


Zend_extension=c:\xampp\php\ext\php_xdebug-2.4.1-5.6-vc11.dll[xdebug]xdebug.remote_enable = 1xdebug.remote_ Autostart = 1

4: First install vs will prompt this, need to configure the path of the next Php.exe, add the following items in the user settings


"Php.validate.executablePath": "C:\\xampp\\php\\php.exe"

5: In vscode php file hit a breakpoint, point listen for XDebug project run, configuration without change, default can be

6: Jump out of these keys after running

7: Open the PHP you want to debug directly in the browser (not the file path but the address of the server (http://127.0.0.1/test.php)), Vscode will hit the point where the break

Precautions

PHP Maximum execution time seems to be 30 seconds, more than 30 seconds will automatically terminate, so when debugging to modify the time, in the php.ini file to modify the maximum run time of 5 minutes


max_execution_time=3000

Expand

Hbuilder and Vscode configuration xdebug the same time, the browser opens the file Hbuilder will automatically hit the 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.