Blog

3
May

Debugging and Profiling Aspects for PHP website

Posted by: admin Tags: , , , , , ,

“ Walking on water and developing software from a specification are easy if both are frozen. ”

“Reworking defects in requirements, design, and code consumes 40-50% of the total cost of software development.”

“60% of all defects usually exist at design time.”

Software Testing IS costlier than we suppose

RTI study revealed that software bugs cost U.S. economy $59.6 billion every year.

Extended labour was deployed to develop already working program, but it was not enough mature to put into live environment.

50% of staff is generally spent solely on testing and debugging activities.”

This means that website or software development gets prolonged many times as extra time, money and human force is required to examine completed product.

Production ready application is subjected to pass series of simple and complex tests.

Testing takes extra time and even stimulates re-designing from ground up.

Pebbles always come in the way after first  loop of software development life cycle (SDLC).

All bugs are NOT discovered in the first place and therefore multiple steps are repeated during software development process.

While releasing builds, every developer faces problems, and it becomes unclear what is really going on here and why the problems arise.

New version of website is a mix of code lines written by many programmers.

Most of the time, these issues are logical, and few times with database.

Website engineers often need to catch a webpart or script that consumes intensive amounts of

  • CPU
  • memory
  • any other resource

and estimate how much time it takes to execute.

“Writing more chunks of code to debug existing code lines is although common practice, it is exaggerated in its capacity to single out problematic snippet.”

Following are few industry standard tools  that come in spare in this situation.

  • PHP DebugBar
  • Xdebug
  • Sublime Text 3
  • Debugging with Eclipse
  • Profiling with Xdebug

All of these tool have their pre-requisites, pros and cons.

Let us take a brief look at each one.

  1. PHP DebugBar

It is easily integrated in application project and shows variety of profiling information from all parts of website.

It notifies with messages of debugging requests added by you  and displays full request, like that for

  • $_COOKIE
  • $_SERVER
  • $_POST

$_GET arrays.

etc.

You can either download the complete source code and install on your machine

or

use composer to install it.

  1. Xdebug,  for debugging

Xdebug is an extension for PHP programming language itself.

It provides genuine debugging and profiling insights for PHP scripts.

Xdebug displays a full-stake trace information, including

  • errors
  • function names
  • line numbers
  • filenames

And more

Xdebug allows liberty in using IDEs and works in interactive manner with supported environment, like

  • Sublime Text
  • Eclipse
  • PHP Storm
  • Zend Studio
  1. Sublime Text 3

Sublime Text editor has a plugin that can be used to debug PHP code.

Under the hood the plugin uses Xdebug only.

So it has similar features to that of Xdebug.

  1. Debugging with Eclipse

Needless to say, Eclipse is the most free and powerful IDE widely adopted by recognized shops worldwide.

Eclipse comes in all flavours and supports all major programming languages, including PHP.

Again, many software folks configure Eclipse for PHP to use Xdebug due to its comprehensive and versatile set of functionalities.

  1. Xdebug, for profiling

Alike debugging, Profiling gives us information about  the cost of each script or task executed

in web or mobile application.

Profiling helps to provides granular level information about how much time a task takes,

and based on that, we optimize our code to consume less time.

Xdebug possess a profiler as well, it is disabled by default.

To enable its profiler functionality, open the configuration file and at the end of file, place the following two lines:

xdebug.profiler_enable=on

xdebug.profiler_output_dir=/var/xdebug/profiler/

And that’s it. You will see required information next time you run the application.

“Reworking a requirements problem once the software has shipped costs 50-200 times what it would take to rework during requirements.”

Continue exploring more at..

http://www.blisswebsolution.com

Simply to read more articles on

  • web application development
  • eCommerce related ideas or
  • to  get practical inputs or techniques to enhance your own mobile application navigate to

http://www.blisswebsolution.com/blog/

Bliss Web Solution Pvt. Ltd. is a top-notch web development company specializing in optimization of  high traffic websites.

To delve deeper into technicality or optimize your large scale Magento web portal, just drop an e-mail to us at enquiry@blisswebsolution.com 

and we will reply you within 24 working hours.

You can freely attend weekend discussions held at our office in Ahmedabad.

Just call us on  +91 98256 77818 to raise a ticket or to input new project in our system to complete it within tight deadlines of time.

Categories

Categories

Archives

Archives