The community is working on translating this tutorial into Spanish, but it seems that no one has started the translation process for this article yet. If you can help us, then please click "More info".
If you are fluent in Spanish, then please help us - just point to any untranslated element inside the article and click the translation button to get started. Or have a look at the current translation status for the Spanish language.
If you see a translation that you think looks wrong, then please consult the original article to make sure and then use the vote button to let us know about it.
Please help us by translating the following metadata for the article/chapter, if they are not already translated.
If you are not satisfied with the translation of a specific metadata item, you may vote it down - when it reaches a certain negative threshold, it will be removed. Please only submit an altered translation of a metadata item if you have good reasons to do so!
Debugging allows you to step through the execution of your code, monitoring what it does and how it works. It's a bit difficult to explain, unless you've tried it before, and if this is your very first time working with a programming language, you may wish to wait a bit before setting up and using debugging. On the other hand, debugging can be a huge help in finding those pesky bugs, and it will make you a much stronger coder. It's really up to you whether or not you wish to setup debugging now or wait until later on.
In previous chapters, we installed both Apache and PHP on your machine. Thankfully, that's almost everything you need, to make debugging possible for you. In TSW WebCoder, go to the Debug menu and select Setup debugging. You will be presented with a wizard, which will walk you though the entire process of setting up debugging on your machine. It's pretty straight forward, but just in case, I will walk you through the wizard to make sure that everything goes as planned.
- On the first page, you don't have to do anything. It's simply a welcome screen.
- On the second page, you should keep the default selection of setting up full debugging.
- On the third screen, there's a bit of information of Apache and PHP, but since we already installed that, we can just move on.
- On the fourth screen, you should tell WebCoder where to find your php.ini file. If you followed the directions in this tutorial while installing PHP, and didn't change the path, it should look something like C:\Program Files\PHP\php.ini. Click the browse button to locate it.
- Now, on the fifth screen, we need a DLL file which will allow PHP and Apache to communicate with the debug client inside of WebCoder. You can get it from http://www.xdebug.org/, by selecting the DLL that fits the version of PHP you installed to the right of the website, under Windows binaries. Download it to the ext directory of your PHP installation, usually C:\Program Files\PHP\ext\. Once it's downloaded, find the path in WebCoder by clicking the browse button to locate it.
- On the next screen, you should leave the settings as they are, unless you have a specific reason for changing them. The default values should work just fine.
- Now it's time to modify the php.ini file, to enable the Xdebug module we downloaded. WebCoder will do this for you, if you simply click the Modify button. After the modification, Apache will require a restart to pick up the changes, in case it's already running - this step is rather important, so if it is running, restart it. Otherwise, now would be a fine time to start Apache up.
- On the next screen, you should locate your document root for Apache in the first textbox, and the localhost path in the second. If you followed this tutorial and didn't change anything, the values entered should look something like this:
Document root: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\
- On the next screen, we can test if everything worked the way it should. Make sure that Apache is started (and restarted, as described after the modification of the php.ini file) and then click the Test button. If everything goes well, you are now ready to debug!