Note that if you are running Zend Studio, you’ll need to follow the steps in this article to enable Xdebug support. You can also make sure that the default web server is localhost if that’s the case, which it’ll likely be for a lot of people doing development. This sets the default for debugging sessions and lessens the configuration required for each debug session. Open up Eclipse’s preferences and go to PHP -> Debug, and ensure that XDebug is selected as the PHP debugger. Thankfully, configuring Eclipse is fairly straightforward. #Zend studio 10 debug code#Since the code will be executing on the web server (Apache), you’ll need Eclipse to “hook in” using the Xdebug protocol. The next part will be configuring Eclipse as a debugging client. You should be able to start Apache now without troubles. zend_extension_manager.optimizer_ts = "D:\XAMPP\php\zendOptimizer\lib\Optimizer" zend_extension_ts = "D:\XAMPP\php\zendOptimizer\lib\ZendExtensionManager.dll" To disable the Zend optimizer, find the section in php.ini and comment out all of the entries under it, like so: (This is an example, there may be more to comment out) If you don’t, you’ll notice that Apache will crash every time you try to load it with Xdebug enabled. Current versions of Xdebug are incompatible with the Zend optimizer that is enabled by default in XAMPP, so you must disable that if you want Xdebug to work. There is one last very important step you need to do, particularly if you are running XAMPP. Disable the Xdebug dynamic extension by ensuring the following line is commented out, like below: extension=php_xdebug.dll This is confusing, but since we are already setting up Xdebug as a Zend extension, we don’t need another entry. Then, you should disable the Xdebug entry in the list of dynamic extensions. The zend_extension_ts should point to location of your Xdebug extension DLL that you downloaded earlier modify as appropriate. Zend_extension_ts="D:\XAMPP\php\ext\php_xdebug.dll" Uncomment or add the following lines: Only Zend OR (!) XDebug Now, open up your php.ini file and go down to the section, or create it if it’s not there. You should have already saved the Xdebug extension DLL file to your PHP extension folder. Zend Studio for Eclipse also works, since it’s based on Eclipse PDT, and offers quite a few more features, out of the box. You’ll also want to have downloaded Eclipse PDT have that installed as your IDE, if you haven’t already done so. If you’re from the Java world, you’ll know this as “remote debugging”, which is provided by most J2EE application servers. The plugin basically exposes or provides an interface for the client debugger (running in Eclipse or your IDE) to attach to the server and debug/trace through the code that’s running on it. Now you’ll have to edit your php.ini file to begin using the plugin. Save the file into your PHP extension path/folder. #Zend studio 10 debug download#The first thing you’ll want to do is head over the Xdebug page and download the appropriate Zend extension of Xdebug corresponding to the version of PHP you’re running. Nevertheless, the instructions provided here should work even if you’ve setup Apache and PHP separately on your own. XAMPP is great for hitting the ground running, though you’ll probably not want to use it in a production environment – though you likely won’t be debugging there either. This guide also assumes use of XAMPP, the great all-in-one solution for quickly setting up a web development environment and to get your code running on the server. (See the “Debugging Tools” section of this article for more) However, Xdebug seems to be one of the more popular ones, and Eclipse PDT already has support for it. Because PHP provide no built-in debugging tools, there are many third-party options for debugging. The debugger I’ll be using will be Xdebug. A while ago, a reader emailed me asking about this very topic, so I decided to put together how-to detailing my experience with the topic and how I went about learning it. This has resulted in a mass of third-party tools aimed at facilitating PHP debugging. This contrasts heavily with a language like Java, which has always had strong developer tools. While I like PHP, one of the things that hasn’t been straightforward with it is setting up a proper debug session, where you can step through code. PHP is currently my favourite “hobby” language and has been for some time. It’s even great for things like CSS and XHTML. It’s so useful that I use it everyday for almost any language – Java, PHP, JavaScript to name a few. I’ve written about Eclipse and how useful it can be, with its extensible plugin-based system.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |