![]() ![]() PHP ENABLE XDEBUG AMPPS MAC CODEIf you don’t have a proper text editor, or if you’re using an old one, you’re going to have a much harder time, but I imagine VIM or Emacs has a way for you to step through code debugging. For this reason I recommend setting up your debugger on VS Code or on whatever tool you like to use. It’s so much nicer to just push the button press F5 on your code editor and just run the code. Breaking on errors can save you lot’s of time and mental energy this way. But in functions that are called very often, or are in a large loop, you’re going to have a hard time getting to that one iteration through the loop, or that one call where the error is showing up. Oftentimes I’ll find myself trying to run var_dump and die() (a trusty combo indeed), or error log to get to the variable I’m trying to read. It also helps when it’s not very easy to get to a certain part of your code base. Seeing if a PHP array has indexes or if it’s using keys is simple in the debug window, but can drive you mad if you’re trying to follow along. In my own experience learning PHP and using it to make WordPress Plugins, API endpoints, and simply printing information on the page I found it incredibly helpful to use a debugger and see the variables and to see how the arrays were set up. And unless unless you’re an expert already you’ll have to spend a lot of time figuring things out, and printing out variable values. Is it possible to do your PHP development without a debugger? Yes of course. This can often mean you’ll have PHP developers and even other types of developers who need to work on a PHP project briefly toughing it out, and not being able to use a debugger, because it’s too much of a headache. ![]() Xdebug is an incredibly useful tool that’s open source and amazing for PHP development, it has a reputation for being difficult to install. What is Xdebug and why do we want it for our XAMPP setup? Sometimes the hardest thing is lacking the context for how a program is supposed to work, and where it fits on your computer. Sometimes following a guide and just running a few commands on your computer doesn’t teach you much about what’s going on, and if it goes wrong, can be a real pain to recover from, especially if you find yourself needing to uninstall old Xdebug installation attempts. I’m trying to provide understanding on WHY when you’re trying to get Xdebug working. A guide focusing on the parts involved, and why they are involved. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |