


A brief analysis of how VSCode debugs the code in the PhpStudy environment
VSCodeHow to debug the code in PhpStudy? The following article will introduce to you how to use VSCode to debug the code in the PhpStudy environment. I hope it will be helpful to you!
In recent months, all projects have been moved to VS Code
(except because of Unity debugging problems, they have been used back to Visual Studio
).
During this period, I took some time to help a friend with a PHP project. However, I have never used the PHP debugging function. Suddenly I found a bug in a project, but I couldn't print anything, and no error was thrown. . This is outrageous. Ever since, I started to fill in my knowledge blind spots again, and I also wanted to use PHP's debugging function. [Recommended learning: vscode tutorial, Programming teaching]
Configuring PhpStudy
I am using WNMP Environment, the web server is Nginx
, Apache
environment is the same process.
Use the default version of PHP
Using the default version of PHP is quite simple, just open the XDebug debugging component
That’s it.
After configuration, you can skip the following part and go directly to configure VS Code below.
Use a customized version of PHP
Why don’t I say that I am so slow in making things, because I often want to knowwhy
and other methods
. So instead of using the default PHP version, I wanted to update to the latest version of PHP 7.x.
Download the new version of PHP
First go to the official website to download the latest PHP 7.4.33
- windows.php.net/download, I make... nts
version. After the download is completed, put it in the corresponding directory of phpstudy, for example X:\path\to\phpstudy_pro\Extensions\php
. Change the folder name to the same rule, for example php-7.4.33nts
.
Download and configure XDebug
The package just downloaded does not contain the XDebug
plug-in, we need to download and configure it ourselves.
XDebug
The official website has a very considerate function, which is to paste the information output by the local php_info
into the input box, and it can help you analyze the information you want to download. version and give the download address. Enter the URL xdebug.org/wizard and click the *Analyse my phpinfo() output* button.
Copy the downloaded dll plug-in to the php-7.4.33nts\ext
directory, and then add the following information to php.ini
(add directly Just at the end, make sure it is after the OPCache
configuration):
[XDebug] zend_extension="D:\phpstudy_pro\Extensions\php\php-7.4.33nts\ext\php_xdebug.dll" xdebug.mode = debug xdebug.start_with_request = yes xdebug.client_port = 9000 xdebug.remote_autostart = 1 xdebug.collect_params=1 xdebug.collect_return=1 xdebug.auto_trace=On xdebug.remote_enable=On xdebug.remote_host=localhost xdebug.remote_port=9000 xdebug.remote_handler=dbgp
Remember to change the value of zend_extension
to the actual path and actual location of your plug-in name.
Test whether the configuration is successful
First restart the web server (whether Nginx or Apache), and then use phpinfo()
to print the PHP information to see if There is XDebug
plugin.
Configure VS Code
Make sure the PHP Debug
plug-in has been downloaded in VSCode. You can search to download, or click here to jump to download - marketplace.visualstudio.com/items?itemN….
OpenFile->Preferences->Settings, add the following content in the configuration:
"php.validate.executablePath": "D:/phpstudy_pro/Extensions/php/php-7.4.33nts/php.exe"
Finally click *Run and Debug* button, add a configuration in the created launch.json
, or find an existing configuration to modify:
{ "name": "Listen for Xdebug", "type": "php", "request": "launch", "port": 9000 }
For more knowledge about VSCode, please visit : vscode basic tutorial!
The above is the detailed content of A brief analysis of how VSCode debugs the code in the PhpStudy environment. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

IIS and PHP are compatible and are implemented through FastCGI. 1.IIS forwards the .php file request to the FastCGI module through the configuration file. 2. The FastCGI module starts the PHP process to process requests to improve performance and stability. 3. In actual applications, you need to pay attention to configuration details, error debugging and performance optimization.

Steps to debug a Vue project in VS Code: Run the project: npm run serve or yarn serve Open the debugger: F5 or "Start debug" button Select "Vue: Attach to Chrome" configuration attached to the browser: VS Code automatically attached to the project running in Chrome Settings Breakpoint Start debug: F5 or "Start debug" button Step by step: Use the debug toolbar button to execute the code step by step Check variables: "Surveillance" window
