PHP in Visual Studio Code: Setup Debugging

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello there, first of all, let me show you an error I am receiving when opening visual studio code I will show you how to fix it. Let's open Visual Studio code I get this error below. Let me show you how to fix this first close visual studio code Go to this folder. I assume you have already installed XAMPP If not, then you can watch on one of my videos to install it link is in the description Go inside go inside XAMPP folder, go to the PHP folder Copy the path to the PHP folder and windows search to edit system environment variables Open it and click environment variables button and in this window go to the path Select path and open it hit new New path and paste the same PHP folder path, we just copied That's it hit OK and close these windows. now, open visual studio code again and the error is gone, the error window is not showing anymore to allow PHP debugging we're going to do some arrangements Assume that you have XAMPP installed.. go the XAMPP folder and start Apache server first hit start in the Actions column, to start Apache server So if the color is green, it means that it is running. Apache server is all that you require to activate in XAMP for this tutorial Now open web browser Type localhost and if this page appears, it means that out it need to go to the PHP info Page so click a PHP info button now open this link in the web browser Open this wizard.php page Copy I'll starting from the first line down to this line go to the page will open and paste it and hit analyze my PHP info output This is the file to download that matches my PHP info the file must match your PHP information Download the file open the Open it in the download folder and copy our cut it And then paste it to this path go to XAMPP find the ext folder in the XAMPP PHP folder and then paste it here and We are done with that part Open visual studio code again Need to add an extension go to view extensions or hit ctrl shift X And search for PHP. We are going to install the PHP debug Extension so hit install scroll down the details and copy these two lines So there are three lines we need to enable remote debugging Copy these lines ctrl +C to copy Go to XAMPP PHP folder And find PHP configuration setting file or PHP or php.ini file and edit it Go somewhere by the end of the file So here, paste those lines there's one more line we need to paste here Go back to the web browser and go to the previous page and copy this line And paste it below the previous lines we paste it in the php.ini we are all set ... save and close the php.ini file and restart the XAMPP Apache server So stop and start again from the XAMPP control panel we go to Visual Studio Code again Open the index.php file As I said i've already prepared to PHP file I will show you where it is located Folder is inside c:\xampp\htdocs Which means the folder is myTestApp .. you can name your app or folder as you want So select the folder and hit select folder Open the folder in visual studio code and there I have the file called index.php Let me show you the folder in the explorer again I am back to Visual Studio Code. To be able to debug, we need to add a breakpoint I will add the breakpoint in line five Then go to this icon or hit Ctrl+Shift+D And start the debugging to see debugging in place, go to browser and open php there .. so localhost/myTestApp/index.php And you can see that the code has stopped in the line where I put a breakpoint Check the locals and you will see that the variable i is uninitialized To step over hit this icon or hit F10 The variable value changes in the locals window Step over again and the value of variable $i changes again Step over until this line of this piece of code is finished And now the index.php page Is loaded in the browser That is how you php debug in Visual Studio code And we are done here ... bye
Info
Channel: Tech VideoStack
Views: 35,876
Rating: undefined out of 5
Keywords: php debugging in visual studio code, php debug in visual studio code, setup php debugging, php debug vscode, php vscode, vscode php debug, php enable xdebug, debug php code, php intellisense, php debugging, php debug, php debugging tools, php in visual studio code, visual studio code, php, xampp, visual studio code php, xdebug config, php install xdebug, php tutorial, php tutorial for beginners full, vs code, php xdebug, php debug tool, vscode error, how to debug php
Id: m92YCeZq2Vc
Channel Id: undefined
Length: 10min 16sec (616 seconds)
Published: Tue Aug 20 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.