Here is the short compilation of materials about debug and profiling in PHP where everyone can find links to the interesting materials on the WEB and also my personal experience.
You can look at the following slides to get the information about debug and profiling for PHP in general
http://www.slideshare.net/jignesht/debugging-in-php-presentation
There a lot of options available out there, but I worked with ZendDebugger and xdebug. The benefit of ZendDebugger is that it is shipped with Zend Server and supported by Zend Studio by default. So if you are working completely on Zend's software stack - it can be reasonable for you to use ZendDebugger. Anyway it is closed source software distributed only as compiled binary, so can't be available in Linux repositories out of the box. Also it utilizes its own debugging protocol that has a binary nature in contrast to plain text/XML DBGp protocol used by xdebug. You can find detailed DBGp vs Zend Debugger protocols comparison in article by Derick Rethans.
On other hand, xdebug - is an open source solution, so
I recommend this debugger and all examples that will be presented in this article are listed in respect to xdebug debugger.
Installation
Debian/Ubuntu users can do:
# sudo apt-get install php5-xdebug
RedHat/CentOS/Fedora users:
# yum install php5-xdebug
Installing from PECL is as easy as:RedHat/CentOS/Fedora users:
# yum install php5-xdebug
# pecl install xdebug
# load extention in appropriate xdebug.ini
echo -e "zend_extension=\"/usr/lib64/php/modules/xdebug.so\"\nxdebug.remote_enable = 1" > /etc/php.d/xdebug.ini
# restart Apache
/etc/init.d/httpd restart
To make sure xdebug was successfully installed, just type
# php -i | grep xdebug
OR
call phpinfo() inside your PHP script and you will see the output of xdebug settings.
Generally you are ready to go with debugging.
OR
call phpinfo() inside your PHP script and you will see the output of xdebug settings.
Generally you are ready to go with debugging.
Further reading
You can continue reading the following list of articles about debug and profiling in PHP with xdebug:
Why use Xdebug?
PHP debug process internals with Xdebug
Xdebug PHP scipts profiling examples
I've listed only a small piece of available functions provided by xdebug, there are lots of methods and magic tricks out there. Generally using debug & profiling practices will help you greatly increase your performance in investigation of issues/problems you have, and allows better understanding how everything works, especially for projects with huge code base like Drupal or Magento. Enjoy!
Why use Xdebug?
PHP debug process internals with Xdebug
Xdebug PHP scipts profiling examples
I've listed only a small piece of available functions provided by xdebug, there are lots of methods and magic tricks out there. Generally using debug & profiling practices will help you greatly increase your performance in investigation of issues/problems you have, and allows better understanding how everything works, especially for projects with huge code base like Drupal or Magento. Enjoy!

Little long but really helpful thing I have found here. I think it will help to many other people.
ReplyDeletephp application development
nicely write for php zend development lovers. Awesoem.
ReplyDeleteoffshore software development company
I would be pleased if all WebPages provided such articles.
ReplyDeleteWeb Development