原文:http://articles.techrepublic.com.com/5100-1035_11-6184573.html
Good developers use good tools and design when writing applications, and the same is true for Web-based applications written in PHP. Two tools that are very valuable for PHP applications are Komodo and Xdebug. Komodo is a cross-platform IDE that can handle debugging remote PHP applications using the DBGp protocol, and Xdebug is an extension for PHP that provides debugging support. Put them together and you are able to remotely debug any PHP applications on your server.
The first step is to install Xdebug on the server where the scripts to be debugged are being run. This can be easily accomplished using PECL. You will need to install the Apache, PHP, and PEAR development files; most Linux distributions provide these as packages, such as apache-devel, php-devel, and perhaps php-pear. With these packages or your distribution's equivalent, execute:
Some distributions provide packaged Xdebug binaries, so look for that first; if it's not included, you'll need the Apache/PHP development files to build it from source. Once that's done, edit /etc/php.ini or the equivalent and add:
Unless you are planning on running the IDE on the same host, change the Xdebug.remote_host keyword from localhost to the hostname of the machine you will be running the IDE on.
With Komodo, make sure that you configure debugging support correctly. Enter Preferences -> Debugger -> Connection and set the port to the port you defined above with xdebug.remote_port (in this case, 9000). Make sure that Debug -> "Listen for remote debugger" is checked.
Configuration is done. If you haven't done so already, restart Apache on the server and then browse to a page on your site. Load the page, but append the XDEBUG_SESSION_START get variable to the URL, for instance:
If everything is configured correctly, Komodo should alert you that a remote application has requested the debugging session to start. Select Yes, and you will have a new document open with the code of the page and the debugging session beginning.
If it doesn't work the first time, make sure that the remote server has straight access to the debugger's port on the machine. If there is a firewall in between the IDE and the server, you'll need to make sure the firewall forwards connections on that port to the computer that the IDE is running on.
Delivered each Tuesday, TechRepublic's free Linux NetNote provides tips, articles, and other resources to help you hone your Linux skills.