 The slides are posted online linked unjoined in if you want to follow along if you want to see the coding examples the slides Please feel free to go grab that and follow along Has anyone ever here had a problem with coding and debugging? My hands all the way up there completely ever had a problem like this Okay, or maybe your problems not the car falling in the water, but maybe you had a problem is that you can't figure it out so you you bring out the big guns over here and the Upper left you bring out the air log, right? Okay, it kind of helps helps you solve the problem But then it kind of doesn't work. Okay, so then you Move on to maybe you print ours and bar dumps. Maybe some echoes They kind of get the job done. Maybe they drop the crane Drop the car think they can be helpful We're gonna be talking about XD bug, which would be like bringing out to the big crane at the very beginning It's a great way to debug our PHP code a little bit about me. I'm developing for over a dozen years master's degree Information systems a senior software engineer. I code all day Working from home in the basement I work primarily on that drug testing platform. I get people fired for work Not directly. Okay We do a lot of drug testing with a random pre-employment drug testing that kind of stuff It's mentioned I organize the Utah user group if you're ever out there on the third Thursdays Come join us for food and discussion. I have a couple cyber security certifications And I write questions and do exam development for IC squared volunteer for their certifications Love flying drones fishing if you want to talk about the outdoors with me feel free to me up Have five little boys at home. I'd like to go outside. It's been a lot of time outside Playing around my poor wife is home with five boys right now by herself I have lived in England. I lived in Manchester area for a couple years Nelson, Workington If you want to talk about those places come talk to me. I love those places There's where I live big mountains snow that kind of stuff and If you're open West is a conference out the Salt Lake area That's kind of a polyglot conference is fun. They have lockpicking other things. That's a local conference to me I don't organize about volunteer there and speak So we're gonna go over this is kind of the overview high-level overview where we're going with the agenda the schedule we have What X debug is we'll talk about what it is. We'll talk about why you use it when you'd use it I want to make sure we focus on some time setting up. So we'll go over how to set it up how to install it get it up and running That's important thing that many it's a major hurdle that many people run into setting it up and talk about using X debug The emphasis will be here would be on with PHP storm As the IDE being used but any IDE can be used it has a plug-in So we'll start off with some live examples. Hopefully the Live examples go smooth here X debug you see picture of Derek Rathens. He's here in the audience talk to him to if you any questions about X debug It's posted as it's open source. It's on github or come talk to me We'll take some time out burden off of him. It was a big thank you to Derek He's a big contributor to that not the original author. So We've seen a file like this perhaps when we're coding along We have some a You know some methods to follow we have some code to debug And let's say we're running it. We're into problems. Okay, so we're We go to run that PHP file and we get it was getting an error. We don't know what it's going on So maybe we go in there and we start You know adding some echoes okay echo line The value you've seen this before right? We're trying to figure out what's going on So we're gonna add some echoes in there and other things okay Next debug If I turn on the listening here and I have a breakpoint set up Will allow me to step into the code and see exactly what's going on So I can see here. Okay, the value is two. Okay, that's good It's getting us somewhere Okay, it's still working right when I haven't hit that error yet. It's still behaving like we expect We can see the value. We can see what's going on. You see okay. Here's the server values We can see the class we can maybe Interact with the console so we can do dollar sign value It's played by two This can tell six. Okay, so we know values three at this point we can interact with the code And see what's going on and we can continue on and and and see that okay next up is gonna hit that and Now it's gonna hit the problems. Okay, so we can start to step into the code We can see what's how the code is behaving we can see local variables. We can interact with the class We can interact with our PHP What a different programming languages have this maybe you use the debuggers on the consoles for JavaScript and interacted with the code there And X debugs give us the ability to interact and debug our code Continuing on with the slides. What is X debug? We kind of already went over this part just a quick introduction So it's a step into debugger My first debugger stepping into was a C++ in the mysteries of that language. It was very helpful Many years ago. It also has profiling available We won't go into that but no it's available and it uses the debugger protocol for the communication Which is used by some other programming languages to? debug languages Been available for about 15 16 years As mentioned in Derek Gretens originally developed it as author. That's a PHP extension publicly available It's written in C code. You can go poke around on the github repo and see what it looks like An open source. It's free. You don't have to pay for it to use it Why would you use X debug? So another exact analogy? Have you ever tried to cut down a tree with a herring? Okay, well Monty Python reference there, right? We want to use a maybe a hatchet That would work for a tree that some of the trees are pretty big though, but it kind of work Again, this is kind of where we come back to the you know Are we doing echoes and var dumps and print ours and air logs? Not that these aren't helpful, but there's perhaps a better way depending on you know our scenario our situation There could be a better way to be debugging the code So the typical process that we we use when we're not using the X debug We add some outputs right we? We blow the page We look for that output right maybe look for the line number Which makes some changes to the code again? We add some more outputs And we repeat that over and over and then we try to make sure we clean it a lot because we maybe forgot a few Echoes or var dumps or air logs and whatever using and though the page again to make sure it's all cleaned up Okay, that's so that's a common debugging without X debug X debugs like bring the chainsaw out Chain saws are very handy Family has a cabin middle Utah we use chainsaws You know if you don't want to use a hatchet or a herring try to cut down the trees You got to use a chain saw So with X debug you turn on the debugging in your IDE You add some breakpoints and you run the script or load the page and start stepping into the code You get far more information You're not adding lines that are useless that you had to go remove later You can actually see what's going on It gives you live values. You can see the actual values of different variables It tells you the code path you can get a full stack trace and see where the code how it how it arrived there and What's what's gone on up to that point supported by most major IDEs In the examples we're here is a PHP storm, but most major IDEs have a plugin available for X debug These the faster development time instead of debugging and spending hours debugging Hopefully this it cuts down it my experience has been it cuts down quite a bit And what may have taken a couple hours turns into a five or ten minute task? Because I'm able to debug and see what's actually going on. I Like to also put breakpoints on exception handling So many times exceptions hit now again the code stops and I can see that Also gives a better understanding of what's actually going on in the code. You can actually see what's happening And what's what's occurring? It doesn't require any code changes as I mentioned so you don't have to add those extra lines and try to worry about cleaning them up correctly You know it's not going to be in there because you didn't add them in the first place So it's a good clean solution for debugging Setting it up As I mentioned if you want to fall along turn on your environment turn on your laptops and fall along feel free and The slides again are posted linked on joined in so if you want to follow along and look at the instructions If you don't have it set it up if you don't have it set up yet, and that's your struggle your hurdle Get it turned on now. Let's just try to work through it I'll be available afterwards too to help set up to documentation JetBrains has a really good documentation for setting it up The first idea is you need to install X debug. We'll go through each of these seven steps in depth But initially it's kind of the overview to install it. You prepare your IDE Set up some break points activate your debugger on your server on your IDE Start the debugging session whether that's in the browser. We're going how to use it with with the restful clients and terminal Reload the current page run the script and it's a set some server mappings. We'll go into all this Make it easy X debug has a really good documentation To have an installation instruction page we fall along Download if applicable Install it or compile depending on what you're doing You configure your PHP to use to know how to use X debug the different settings with it and restart your web server The easiest way to install it if you don't already have it Get clone you clone it down CD into there and rebuild Run that script and it's going to go do all your makes and you're cleaning up into all Okay, so three main operating systems that we're using for development We'll go into each of these as well just briefly With windows, there's basically next debug install screen you copy and paste some stuff in and it gives you the file And if you're Mac, so you do a pickle install X debug Or brew Linux you can W get it and Similar thing install it With windows as mentioned there's an IDE basically you do a peach PI or your peach be info You copy and paste it into a text file or whatever and you paste it in there And it'll give you do allow it to install really easy made it made it really simple Then you restart your brain with web server and You'll be able to start using X debug Again, if you're on Unix based systems, we have W get you know you tar ball next CD X debug 2.6 the current Peach PI is config configure enable debug make make install But if you're doing that first set up instructions, that'll tell you that the That sh file will install it for you do all these things for you But if you're if you're not if you can do it on these steps, too Yum install this is another another version of it Depending on your obviously your operating system, so we breathe kind of through that again these plays are all posted if you want to fall long The easiest is that first the first instruction I gave so update your peach PI and I you got to add a few instructions You want to make sure you have Zen extension For the pointing to this is on windows or if you're on a Mac or Linux To wherever the debug is and then you have few settings So for example remote enable these are the things I like to use And remote remote auto start set on port 9,000 Your host and IDE Key is very important. I use PHP storm as well as the suggested one for PHP storm Then restart our browser Our web server so windows you go to the services find the Apache monitor and restart it On the system's pseudo Apache control TTL restart or if you're using engine X engine X restart And that'll pick up on the changes and let you use it. I like to verify that's actually working. That's very important You can do a simple PHP info page and search for XD bug If you're on the command line, you can do PHP dash I pipe it to grep XD bug and make sure stuff shows up So if you have your PHP info might look something like this Okay, that's it shows you that it's there and it's available and ready to use If you hit command line Grep XD bug and a bunch of stuff will spew out. Okay, you see that's there and it's enabled You can also get the work the instructions to where your I and I file is for XD bug if you want to change anything any settings It's a prepare PHP storm. So PHP storm needs to know about XD bug You gotta tell it to start listening for database can ever for the connections So there's a handy little button looks like a telephone and it's hung up You click it and it becomes the second one where it's green. So it's listening now So now your PHP storm is set up to is listening for these incoming connection connections To debug using XD bug. There's a menu you can run You can also start it from down here start listening to for pp debug connections Is an alternative place to start that up and you have a bunch of settings? So we'll flip over to PHP storm to show that one cleaner so if you go to your settings and Go to PHP For debug and see it. Okay. Okay So you have some simple Things here. So you have ignore external connections break at first line of PHP scripts. This one's especially helpful When you first trying to get XD bug started, so it'll stop on the on the first the first line of any PHP scripts that come in Rather than having to go set a breakpoint and figure out it. Maybe you don't know where it's coming in from That's another good time. I found to set that turn that on Max similar max connections at the same time simultaneously You can tell it to listen to a different port Force break when there's no path mapping mapping we'll get into path mapping here in a second Force break the first line outside the project Zen debugger and evaluation won't go into those ones, but this is the main place to go set it Change those settings Then you can see it there, too. It's in the language and frameworks PHP debug Project mapping mapping so on PHP. There's servers the server section We'll flip over for that one, too so I usually just search for server and PHP servers shows up So in this case we have XD bug demo. Okay, maybe something just in your Etsy health file or whatever it's why you're using URL and you set up the pathing so mapping so this is the in this case. This is running on a vagrant VM So it's var dub dub dub html XD bug is where this one's sitting You can also map it up further if you wanted to so I think I could do it up here or even up here So you can var dub dub dub Let's set it up to run for anything underneath that directory So make sure you set that up If you don't have it set up, it won't pick it up or don't start prompting you you have to go set it up Anyways, okay, jump back to the presentation Okay So after you get that set up We want to set a break point in our source code So you want to be able to stop the debugger and and step into that code Try to hit a line, you know, it's gonna be hitting It has to be executable line if you put on a blank line, it's not gonna hit So make sure it's on the line Or break on that first line like I mentioned turn that setting on you can make sure that it hits the The code make sure it's gonna stop So in this case, we see a step into set up a break point over on the the column there the red circle and When the code reaches there, it'll stop Acting activating debugger. So let's say server should say client So usually like a browser plug-in if you're using a browser Every browser has a bunch of these. There's not just one. These are ones. I found that are easy They're quickly added on so for Firefox, there's easiest xD bug Chrome has xD bug helper Safari has xD bug toggler And xD bug launcher for opera. So depending what up which browser you prefer or need to test with There's different ways to turn that on and it looks like that. So in this case, it's just a little button I'll walk over here and point out it might be a little hard to see. So right there This is gonna add the button onto the browser And when you click on it's gonna essentially add a cookie that tells xD bug to go ahead and turn on So in this case step into it's gonna tell it to stop and the ID is gonna pick up on that connection and gonna start debugging on that specific spot Chrome again kind of similar thing. We have a button that's added And when you do that, it's gonna start debugging into that spot. There's a few different ways you can do it You can also add a URL or add a git parameter of x underscore xD bug underscore session underscore start equals the IDE key which in our case is PHP storm Standing with a post you can add another post parameter That will also initiate those You can also alternatively I should say have a header a header with the name of cookie With the value of xD bug session would equals ID key, which is PHP storm for this scenario You can also make a book marklet if that's something you want to do And all these different ways will initiate that connection So over here, we see I've got the URL added on to have Question mark xD bug session start equals PHP storm And now the browser will pick it up without having to add that little plug-in Fusing something like insomnia or some sort of REST client This one has a header Where it's gonna be added in sorry, this is the URL so it has the URL added in xD bug And so when you go to submit this your IDE will pick it up And so you can use REST clients to do that as well In this case it's using the Header so I added a cookie on that tab on the post you go the headers tab Cookie and then add it all of them have different way to add the most of them have a way to add the header there This will again will initiate the next debug connection We're using REST client another common one we see You can add it to the URL in the with the git method Or if you're using a post you can add it to the post Header's you can add a cookie xD bug session again To start off that connection Anyone using soap? So anyone I'm one of the few of lucky ones. Yeah, there's a few okay a few lucky race hands raised soap you I saw in the drug testing world for whatever reason they really like soap. I Don't know what it is. One of the systems from legacy systems. We have to interact with we usually have a REST API available that we provide along with the soap version because everybody likes soap in that industry So if you're using New soap like this is the example. There's not new soap. That's an old library if you're using soap UI We'd be another example here where you can add it to add to the URL You can add it to the header. So in this case we have a cookie You go and add it down in this section down here, and you can fire off connections the one you're using a soap API you can also initiate the debugging It was really important. That's one of the biggest hurdles is getting it to actually start up Once you get a start up and it starts working the first time's like okay now I got this and so Understanding that you can do it with all these different tools. It doesn't just have to be through a browser It can be through a restful client. It can be through an API client It can be through your command line to terminal it can be in lots of different ways you can start this up depending on how you're developing I How your process looks so it's important to remember that and to I know that your different browsers or different tools are going to have Different ways to initiate these connections So you click on the little debug button in the toolbar or add the get or add the post or add the cookie That's going to help you get started on your your connections can help you to be able to start debugging We know the current page and It's going to ask you is to it says some initial path mapping mappings If you haven't set this up already. So again, this is just the servers. We're just basically telling you telling the The client this is where the code sits on this the server that's running Now if this is your local host, you might you know your local machine is the past can be different There's the absolute path on the server is what it's asking for so my case far dub dub dub HTML Using X debug so there's a whole bunch of different settings that you can use with X debug And lots of nice things we'll get into those There's break points. We have stepping through code watches and console go through each of these They go through some of the buttons. Maybe you haven't used or some of the features you haven't seen so break points You can go and view where the actual break points are there's actual different screen for that in PHP storm We can go and view all the current break points Which is really handy when the code starts stopping and you want to go remove some of those It's a good way to manage them all in one spot off for your project So it shows a collection of where all your break points are You can have as many break points as you want and you can have conditional break points conditional break points are very helpful Especially if the break points may be in a loop and where it goes being ran multiple times It acts just like an F statement So you write, you know dollar sign value equals equals equals true And if that can that condition is Returns a true or is true that conditions true then the code is going to stop that conditional break point will be hit I often find it for you know, you know, maybe you have Customer name equals something and you want it because it's certain customers having a problem And so I'll add that to my conditional break points and see what's happening for that specific customer Or their ID rather than having to run, you know run through it every single time It's a very helpful to do conditional break points There's a placement strategy. It's not just drop it everywhere or somewhere You know, you want to have it you don't have it too early Otherwise you'd be stepping to a lot of code and maybe you forget a certain step into versus step over which we'll get to in a minute You don't want to have it too late. You're gonna miss what happened or the exception might be hit Or make your code might air out and you can't see what's going on If you have too many it becomes tedious it becomes hard to manage If you have too many it's just it's just cumbersome Also get to consider things like the time limit. Okay, if your code is some amount of time you need to run it in Or if you're maybe your your UI has, you know, a 30 second timeout, right? And you're stepping into the code while a request is going out, you know, the UI might stop her listening for it for example So that's something else to consider if you have too many or having to step too far You I might you know my stop listening to you and that's that's depending on how you have your device it up. It might be fine So this example we see a couple break points again, so it's on the instantiation And we want to see the hidden value that maybe the values coming out. Okay, so it's gonna stop at both those points Here we see all the break points available. You can also manage the conditions here So you could say this condition is you know, whatever condition you want to have You can tell it to log message of the console. You can evaluate specific and expressions You can tell it to remove the break point which once they sit with that one's very handy You know if you want to remove that break point, you only want to see it once and then you want to remove it That's a good spot to do that at Let's stepping through the code. There's a few different key Commands to run. So you have the play Which will basically tell it to continue on executing as it was before So your code will come through and be stepping into things you play and the code will continue on It's function f8 if you're on a Mac You can also tell it to stop So you want to kill execution basically you want to tell it to stop what it's doing you're gonna terminate the script You have view all break points over there and disable all break points It's really helpful if you want to turn that off and just let the code run again They'll be able to turn it back on again later without them to go find them in the lines of code and click on the column so we also have the concept of stepping over stepping into so this is the Scenario where you have a piece of code where you want to step over the line Where step into would be if it's calling a method it's going to step into that method that's being called So if you're instantiating a new class that has a constructor for example And you step into that it's going to go into the constructor and it's going to step through that Or if it's calling to a specific method it's going to step into that specific method and you can see what's going on So you know following through into the method the step over is going to ignore that it's going to go on to the next line in that file Unless that's another break point somewhere else Four step into again just four step into And step out so step out is going to jump out to the next later out of this the Abstraction level so for example if you're in a class and you step out it's going to jump out of the class Go to where it was outside of there Another very helpful one is run to cursor so if you have your cursor set somewhere on the The file it's going to keep executing the PHP PHP until it gets to that specific line and then it will stop for you with that line Now it's very very helpful When you're trying to you know the problems between point a and point b But you don't have to go set up a permanent break point for example I just move your you know you're moving your cursor through the code and say okay run to here And then I'll just run to there Evaluate expression this is one of my favorites Just be able to evaluate and run some PHP code and see what's going on It shows the value of the address is another thing you see are they Value addresses memory You can hide empty super global variables. It's on by default You can add methods to a skip list So if you want to skip all constructors for example or you want to you know There's a certain method you always want to just skip you can add that to a skip list And it'll always be skipped. You don't have to see it And there's watches. I'm wearing a watch. It's not that kind of watch It's the ability to see live updates on specific code You can add you know, maybe a value or a method call or whatever and every time every line is going to update that That value so you can see what is being What watch the value essentially right so you can see what's going on with that value see what's going on and Know how to interact with that It's another very helpful one if you're having a problem with a specific area in the code and It's you know, I'm sure what's going on. You can see that Again, you can have expressions in there and see what's going on The console the console another area a lot I think I love to use In this case over here. We have Code that you can run and see what the output is so if you had your code break at a specific spot Your your debugging pause for a moment you go in there and start running some commands and Interacting with the class or seeing when you know what specific value is or seeing if the conditionals working or not You can do the same thing with watches But the console is kind of handy if you want to just kind of went off start running through a bunch of commands to see What's going on? So that's a kind of an underused feature. I find That I really enjoy I really like to use My typical day of development I have X debug up and open I use it pretty much every single day many times And just because of the help it provides me the insight it gives me through like the console through the watching and with development Just really helps ease the development process Makes it easier to understand what's going on and when and why and how So we're gonna do a quick summary and then we're gonna go into some more live coding examples We're gonna go into actually using the console actually using Break conditional break points. We'll see how that how that works behaves Before we get to the summary actually something back over to the IDE we'll close out the settings and So let's say we have this is another classic problem, right? So In PHP if you try if you try to divide a number what's gonna happen? Can you want to Predict the behavior here? We have a really large number divided by a really the same number plus one You know what's gonna happen? Any guesses? So I'll be brave what's gonna happen? It's gonna be someone I hear I can hear some whispering It's gonna be one Yeah, so if we if we run that Over here. It's gonna give us a double of one good guess or experience That's not truly the answer though is it It is for PHP. It is expected behavior But that's PHP is gonna output one Yeah, if you're using trying to do some math within PHP, you're gonna want to use the libraries like BC BC divide BC add BC multiply And the other math libraries are very good But if you're a developer and you have a maybe you're working on a financial institution. You have some transactions Maybe you have some specific, you know want to make sure your values of your you're very specific on what you're getting and so you have a problem reported to you and You know, you've you've narrowed it down to this specific little area and you want to see exactly what's going on You know if you're running it you see if you're just running it in the UI You might not notice it and you might just keep debugging and adding your error logs and echoes and so on With X debug and come in here add the break point This case let's go to the browser Hit divide dot PHP if you note over here, I have the This set to debug over here To enable the debugging on the IDE I turned on the debugging here with the little telephone And now I had the value so I can see They come into here I can go and And here's the step over I can now see the value is equal to one So what I could do is I could say Let's see if you want to hit the vet this break point here So there's a condition let's do dollar sign value is not literally equal to 1.001 or something right because we that's what we're expecting. We know that's what we want But that's not what's happening So if we go to command line again It's gonna it's gonna stop there because that value is not equal to that so now we have a conditional a conditional break point We see that's working and help us to determine where the problem was now. We can actually see what's going on. I Have a watch over here so you could add another watch of Darsen value Divided by you know one or whatever you wanted to do And it would tell you that's equal to one so you can have different watches added in there And as you step over the code you can see what that that was was happening with it That's a really good way to find problems You apply it in this kind of this way where you know you have a specific problem You know it's a specific area and you can apply those different conditionals It's a right click in this case by the way to add conditionals To stop the break Stop the code So see we have another scenario. We want to fall into the methods I'm gonna remove the So now we're gonna clean this up because we don't want to have it in their course This is going to production. This is serious We don't want to have var dumps going on in production So say you want to follow some methods, maybe you don't understand the logic flow that's going on with specific class So, you know, you want to start you want to have a break point in the start method And there's a few different methods that's different layers going down to So maybe you want to stop it at the instantiation as well. Okay So down here we'll go There so we see the instantiation and step over that We can see the dollar sign value value or follow is a follow methods We want to step into that. So we move to the step into button. It's gonna step into that first method is being called We can see the values equal to we know it was passed in there And we can step over that again or step into it. We can say, okay, what's the second being called? Okay, so now the value is four Okay, then we can step over so don't want to go to the third one. We're fine with that See and you can use this to step into All into different methods and see what's going on With what's your application in this case it failed on the third one? We could see that because it hits the three which is a string and we're using PHP 7 We're expecting a yint and want to return an int which you pass a string in obviously that's going to fail Because it's not that same type Okay Another example, maybe we're having to deal with some array keys And you want to see how ray sorting is working maybe we have a problem with our sorting on arrays so we know that there's gonna be some Casting going on here So we can set a breakpoint on that and go PHP array keys and See what's going on so we can see the ray beforehand We see this is what it's gonna look like We can see how it was built beforehand And if we step over that We're gonna see what it is after the case or we can see you know that how it shuffled and how it sorted So it's very helpful to get an idea of how PHP is behaving behind the scenes To give insight into how it's behaving We can go into Another one here So this scenario we have another array Where we have a bunch of different breakpoints and we want to know if if it's true so PHP if you have if you If you do an if evaluation on a value It's kind of funny And I have ran into a problem where we had code was behaving not as expected And it turns out that we had a string false Okay string false evaluates to what does it evaluate to true? Which is expected we if we get into deep the PHP code We know it's expected because it's not an empty string and it's not equal to zero. So if you render that problem, oh This is a good way to debug into that So we can clear that and go PHP Bull Okay, so now we see the value. We have a true. Okay, that's great. That's what we want It's gonna hit true. That's what we expect and we have value one That's true. I value ways to true in an if statement. We have a string one. It values to true. That's great We have a string false value ways to true again We have a string anything and it evaluates to true We have a null that's gonna hit the false We have an array of Way array an empty ray. We see it's just the brazen Braces of your brackets and it's gonna be false because an empty ray 12.34 true. Okay, so it evaluates that float as a true We have zero another Which is true. There's a little trick one because we had zeros in it And evaluate false or zero is gonna evaluate to a false And a string fault zero is gonna evaluate to false as well So we can use X debug and the IDE tool layover for it to start getting an idea of why our code is failing Get a better understanding of what's happening By setting these different breakpoint strategically stepping into where we need to see what we need for more information So we're gonna jump back over to the presentation here So kind of a summary that we see the X debug the more efficient way to debug We know that we have problems with our code. It's not always flawless It's gonna have problems It provides a much better way to debug than adding in Developer lines will call them Gives visibility into a code and we can understand better what's going on We can know if our code, you know what our code is how it's truly behaving we can see where it came from We can see the methods that were called we can see the memory being used by that We didn't go into the profiling, but we get a better idea of what is going on We have the ability to change code on the fly we can change values We can use the console we can interact with our PHP code We can watch for specific values. We can see what exactly a value is equal to we can get the data type out of it Right and echo is not going to tell you the data type Or if you're in PHP, you can see that it's a string. You can see if it's an int Or bool or null or resource or object array We can watch this line by line without having to add all these different lines of debugging code and get a much better understanding Of how the code arrived where it was So I want to have some kind of discussion time Where we kind of ask different questions and get feedback as a group This is something that a lot of people use or hopefully can use So we want to talk about some These are different topics I kind of want to focus on so what are some set up issues that people had? I know I know that's a major hurdle. A lot of people run into is just setting it up So what are some issues that people have run into a set up and how can we how can that be helped? How can we help with that? So I was using XD bug with Drupal and postman and that was working fine and then I moved to doc sal And for some reason I can't get it to break from postman anymore so XD bugs up and running that's all great, but when I fire in a request from Postman no break. I'm not sure what I'm doing wrong That's a great great scenario. We run into a lot, right? So maybe we're trying to do something different Where it's not it was just stops breaking right? So you add are you adding breakpoints? I'm guessing I can get those breakpoints to trigger If I'm kind of caught in a function internally Because it's coming from an external request. I've tried the cookie method. I've tried putting stuff in the URL I just can't get it to go Thank you, so that's a really good question because that happens quite often so we get a different request me We're using a different tool There's a few different things to check on those So as mentioned in the PHP storm settings, for example, there's the remote connections Specifically we can or external I should say to allow external connections that could be one thing to check So that's another major thing So when you're setting up we got to make sure that if you're using external connections from different different machine to check the external settings Another one is the remote auto start Setting we mentioned I mentioned that in the I&I that really helps with automatically starting it up So there's there's a few different things to check with that Those are usually I found at least has been to the big things another thing is the the mapping on the server So we mentioned the absolute path on the server So that's another major thing to get set up make sure that's that's correct So if it changes for example, we want to make sure we update that so a very good question Any other questions about setup? So no, that's like I mentioned that's a that's that's half the battle right there. Yeah I was looking for just in time debugging. So Automatically at the break point when there is an exception For a warning, okay. Yeah, so the question is about how to automatically add it Like why would I found I just go and add the day when I'm working on a new code I'll just put breakpoints in my trycatches and then as I go along it's gonna get hit That's what I have found I put at the highest level to I can Also, if you extend it, you know, I'm gonna put it up higher so it gets caught, but Yeah, that's a good question So Derek says that there's an option to stop at exception points So that would be the best answer right there PHP still on me said Any other general setup questions? Because this is some of the lot of people has the same problems So this is not so much a setup question, but after find I mean, I know X debugs there I don't know. It's great, but I find myself. It's quite a simple problem So I'll just do a Vardamp or a die or an echo or something And then you get sort of drawn into that track and you sort of forget that X debug is there So how can I be sort of more? Rigorous about using the tool in the first place So how do we really leverage this tool and our daily development? That's good. That's a good point in the past. I've forgotten about it from time to time as well And someone says hey, why don't use X debugs like oh, yeah, I've got that right I don't do that very often anymore. We use it. So you're using it on a daily basis And really I found that I make sure I have my and one of the first things when I start on my IDE Like go and make sure that I have my XD bug listening, you know, I have multiple projects going so I'll make sure the other Projects are all turned off and the only one is listening and I'll make sure it's on for the one I'm currently working on For me that's been just kind of I get it into my daily Process of getting started up for the day is to add that you know saying up the XD bug into that list You know, so I'm going to fire up my VMs, you know, maybe for using Docker or you know, you connect me to server Whatever you're doing You know to have that be part of your initial setup is you know getting up running for the day is just having turning on your debug connections Oh, yeah, excellent. Any others in that in that area? Profiling we didn't really talk about profiling The XD bug has very robust profiling you can go and see exactly what's going on and See that XD bug versus alternative methods, right? So we have different methods of debugging code. We talked about Airlogging and var dumps and stuff