PHP Remote Debugging with NetBeans 6.8

Well, I guess this post might have been added to my blog about the remote development but I guess a different article is better. So as NetBeans 6.8 getting better and better you can also debug your php code with it. All you need is to install xdebug on your php installation and define some variables to the php.ini file and you are ready to go.
Continue reading PHP Remote Debugging with NetBeans 6.8

Debugging Magento Code with NetBeans 6.8 Beta

Well, I’m sure you are aware of how the xdebug is used on debugging PHP applications. However there can be people out there, alone, killing their eyes trying to find out which class called which functions etc. Here is a quick tip for you! Especially if you are trying to find your way with Magento like I do!

As I had mentioned earlier, NetBeans is a great IDE with it’s support to PHP! PHP debugging is around for sometime and used by commercial PHP IDEs like Zend Studio or Komodo or equivalent. With the emergence of Eclipse PDT, NetBeans and of course xdebug, we can freely and easily debug our PHP applications. However as the web evolved, there are not anymore php files to debug but there are “user friendly” urls to debug. So you cannot give the filename to NetBeans and say debug! because most of the web applications out there are now MVC based as this is the new trend in the PHP world. MVC means, one file -index.php dispatches all the requests. So how to debug using friendly urls.

Well you can use your NetBeans IDE to listen requests coming from your browser. That’s what NetBeans does when you click on debug button, which opens the start page (index.php) with a get variable like: ?XDEBUG_SESSION_START=netbeans-xdebug. This value (netbeans-xdebug) can change from your NetBeans configuration (click on preferences and choose the PHP tab). When this parameter is given, you can send any request to the NetBeans and it will listen!

Let’s cut the crap and problem definition and come to the solution: All you need to do:
1. Start the debugging session on clicking Debug button

2. Continue until the end of the script however do not finish the debugging session by clicking on the Stop button.

3. On you browser, write the url you want (http://localhost/magento/customer/account/login/)

4. Add your own debugger identifier to the end of it like: index.php?XDEBUG_SESSION_START=netbeans-xdebug (For magento use http://localhost/magento/customer/account/login/XDEBUG_SESSION_START/netbeans-xdebug, notice that I’m first adding the key and value next to the end of the url)

5. Check your NetBeans to see that your new request is already started to be debugged! Now you can walk around the code and debug it anyway you like it.

That’s All Folks! It really helped me and I hope it helps you too.

NetBeans 6.8 Has Symfony Support, Why Not Zend!

If you have not heard yet, NetBeans PHP developer team has just finished their support for PHP framework Symfony. You can read the whole stroy here. NetBeans PHP guys are really working hard for it!

So why I blog about this?! Because I see this as an opportunity. It’s great that NetBeans now has a great support for a PHP framework (even thought it’s experimental and “beta”) and since this was the most voted PHP framework, I hope the next release (6.9 maybe 6.8.5) of NetBeans will contain a support for Zend Framework too with as much vote as it can have! If you have read the whole article (jump to action! That’s cool!), you will notice that the first comment is when we will be able to see the ZF support in NetBeans. I second that!

So if you are interested on to see ZF becomes the second supported framework by NetBeans, just go the Zend Framework Support issue on NetBeans issue tracker and vote for it. It currently contains 87 (I hope it’s counting:) votes and if we can reach 100 or something it might be enough to a support for ZF too!

By the way, NetBeans 6.8 Milestone was quite a success for me and with Netbeans 6.8 Beta is on the way, wait for another review too. The most important asset for me is to be able to select a configuration file for phpunit runs (not much huh?) and of course PHP 5.3 support too (I wonder if it contains a migration assistant or a function like find backward incompatible functions in the project or shows a notification or something).

Just don’t forget to vote! :)

Impressions of PHP Development on Netbeans 6.7

Here is yet another review of Netbeans 6.7 Beta (I have not yet downloaded the release candidate). I have started to use daily Netbeans 6.7 and started to do everything I do with Netbeans, including remote development (sychronization) and debugging of PHP Scripts. Which you are used to these if you were using Netbeans 6.7 nightly builds. What you might not be familiar with are the unit test creation, code coverage plugin and subversion capabilities of Netbeans (or I have stopped using TortoiseSVN on Windows and shell on *nix)
Continue reading Impressions of PHP Development on Netbeans 6.7

PHP Debugging on PHP IDEs

As NetBeans has started to be a great IDE with powerful debugging features, like most people who are migrating to NetBeans, I would like to use it’s built-in debugger abilities. PHP debugging is not new. XDebug is quite around for some time but it always lacked the attention it has now. From now on PHP Developers are starting to use IDEs instead of colorful text editors. Because from now on, PHP started to be accepted as an Enterprise language. It’s pretty easy to code with PHP, it’s very simple but yet it can be a good base for complex applications. With the newest release of PHP 5, it also contains OOP features and with powerful frameworks built around (CakePHP, CodeIgniter, Symphony, Zend,…) some strict rules apply on designing your application for a cleaner, better code and yet you can still use the quick and dirty ways. :)

Continue reading PHP Debugging on PHP IDEs

Netbeans 6.5 and PHP Support

Well, a new feature has been added to Netbeans from now on. With the new release of 6.5, PHP support has been added and now we have an IDE which fully support code complete (including your own classes, methods, functions and variables), PHPDoc abilities(showing doc for your own classes) and, of course, debugger features. It’s in the RC2 but final release is coming on a week or two.

Netbeans is using XDebug, for debugging. All you have to do is add xdebug extension to your php.ini and set some xdebug property like debug port, debug host and alike. There is a good tutorial here on the Netbeans wiki page. You can also use that link for a good debug tutorial.

Debugging is quite powerful and easy with Netbeans now. Even there are some missing things. You have to setup a debug profile from properties to be able to debug a url, that’s annoying. But it’s on the improvement list as I had learned. Also sometimes breakpoints does not work, even though that I’m sure that that part of the code is used but not opened as in active editor pane. But it does open closed documents if you use step by step debugging. There is also a javascript debugger, which is installed as a Firefox plugin. But I did not yet tried that.

Above from debugging feature of Netbeans Xdebug is also great at showing you errors. As a virgin of XDebug I really felt good when I saw the call stack for the current error. Xdebug replaces current error handler of PHP and shows call stack with error.

I guess it will be great. It’s really lightweight too if you just install PHP and not the rest, it’s only 24 MB. And code completion is also very useful and successful. The only IDE with support of custom class code completion was PDT and of course Zend Studio 6.x (also the lower versions were also supporting that.) which both are basically built on the same code base.

I guess from now on PHP Editor wars will be really great! As PHP grows and becomes more powerful, tools you use to develop it becomes far more powerful. It’s sad to see that C# had a built in debugger in Visual Studio for years even though it was younger than PHP. But I guess you need to have money to develop these kind of tools. At least we have a one now! And not just a black screen debugger and profiler but a GUI with powerful features.

By the way, Fedora is coming too..

NetBeans 6 and antscripts

Well it’s really a pain in the ass to have an antscript java file and use it in the NetBeans. What the real problem is to show class paths and runs it. I really hated it and in the end I also failed.

As I knew that NetBeans was great and should be great I wasted nearly two hours to modify the current build.xml created by Netbeans to create a build.xml which fits my requirements. I tried to add things, remove, modify my ant script to work with NetBeans run command. Anyway I have failed.

After a day of trial I have decided that black screen VIM is better, faster, safer and easier then NetBeans. AND to write “ant deploy” is much better to click on Run!!