debugging PHP applications with Xdebug and Komodo

Source: Internet
Author: User
Tags pear php and port number firewall

Learn about the configuration of Xdebug and Komodo to debug PHP programs on the server.

When writing applications, excellent developers use excellent tools for development and design. The same applies to writing web-based applications using PHP. Two useful tools for PHP application programming are Komodo and Xdebug, respectively.

Komodo is a cross-platform integrated development tool that enables remote PHP application debugging using the DBGP protocol. Xdebug is a php extension that provides debugging support functionality. Using both of these tools, you can debug any PHP application remotely on your server.

The first step is to install Xdebug on the server that is running the script you want to debug, and you can easily accomplish this task with PECL. You will also need to install apache,php and pear development files. Most Linux distributions offer these installation packages, such as Apache-devel,php-devel and possibly php-pear. After you install the same packages for these packages or your distribution, execute the following commands:

# pecl Install Xdebug-beta

Some distributions provide packaged xdebug binaries, so look for them first. If not, you need to use the apache/php development file to build it from the source file. Then, edit the/etc/php.ini file or other peer file and add the following:

Zend_extension=/usr/lib/php/extensions/xdebug.so

[Debug]

; Remote settings

Xdebug.remote_autostart=off

Xdebug.remote_enable=1

Xdebug.remote_handler=dbgp

Xdebug.remote_mode=req

Xdebug.remote_host=localhost

xdebug.remote_port=9000

; xdebug.idekey=

Unless you plan to run the IDE on the same host, change the Xdebug.remote_host keyword from localhost to the hostname on which you want to run the IDE.

Use Komodo to ensure that debugging support is properly configured. Enter the reference-> debug-> connection and set the port number to the Xdebug.remote_port defined above (this example is 9000). Make sure that debug-> is selected for "Listening remote debugging."

After configuration, if you haven't restarted Apache, restart the Apache on the server and browse your site

One of the pages. Load the page and append xdebug_session_start to the URL to get the corresponding variable value. For example:

Http://devel.mysite.com/blog/submit.php?XDEBUG_SESSION_START=1

If all configurations are completed correctly, Komodo will prompt you for a remote application request to open a debugging session. Select Yes, and then you will get a new document containing the page content, starting with the debugging session.

If you are not working properly at first, check to make sure that the remote server has the correct access to the debug port on the machine. If you have a firewall in the middle of the IDE and the server, you need to make sure that the firewall has a leading connection on the port of the computer where the IDE is running.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.