![]() At the moment it halts, you can inspect all the variables’ values so you know actually what is going on. A breakpoint is basically a flag where your application will halt when it reaches it. In Sublime, some extra panels appear where debug information will be shown, after you have set one or more breakpoints. You will notice that your website is opened up and that ?XDEBUG_SESSION_START=sublime.xdebug is added to the end of the URL. ![]() In the menu, click on tools -> Xdebug and click on start debugging (launch browser). We can now start the Xdebug session to see if everything is set up properly. I could have also set this URL in the Xdebug settings itself, but in that case, I couldn’t work on multiple projects without having to change the Xdebug config each time. I could set more settings for Xdebug, however, this is enough to start with. The content will look like this: Īs you can see, I only added a URL to my actual web application. I suggest you save the file within the root of your application, so you can save it in your version control system if you are using any and you can configure it easily at all times. The easiest way to do this is to open up the root directory of your application, go to projects and click on “save projects as”. The last bit we have to do is set up the project within Sublime. In our case, we are going to search for the package “Xdebug client”. Now you can search for any package you like. ![]() Open up the command palette from the tools menu and search for “install package”. Once you have the package control installed, you should start Sublime Text 3. If you haven’t done so already, make sure you can install packages by installing package control. In this case, we are going to install the Xdebug package. One of the strengths of Sublime is the fact that you can extend it easily with packages. The remote log is not necessary, but in case of problems, it’s the place where you can find information about errors that occurred.ĭon’t forget to restart your webserver! Setting up Sublime Text 3 However, If you are using vagrant for example, you will be using something like 10.0.2.2, depending on where Xdebug can find your system. In general you will be using 127.0.0.1 as your host. remote_log = "/var/log/xdebug/xdebug.log" We need to configure xdebug by adding the following to your php.ini file, or even better, to an xdebug.ini file as described here under How-to On Linux. I will be using the latest version: Sublime Text 3. Make sure that Xdebug is working by checking if it’s listed in your phpinfo(). If you are uncertain on how to get this done, please have a look at the link provided in the introduction. Getting startedįirst of all, we need to have the PHP Xdebug extension installed. In this article, we are going to have a look at how we can debug using Xdebug in combination with Sublime Text. More than a year ago, Shameer wrote an article on SitePoint about how you can debug your application using Xdebug and Netbeans. Writing code perfectly the first time around is hard and only a few (if any) succeed at it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |