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.