Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Delicious Brains Blog:
How to Use Xdebug for Advanced PHP Debugging
Aug 07, 2017 @ 15:17:14

On the Delicious Brains site there's a tutorial posted that shows you how to use XDebug for advanced PHP debugging versus some of the usual practices of var_dump or print_r-ing your way through your testing.

You could just debug your PHP code using functions such as error_log, print, and var_dump, (and to be honest we’ve all done it, a lot!), but sometimes they just aren’t enough, and can actually slow you down while developing.

There must be a better way, surely?! Enter Xdebug, the rather awesome debugging and profiling tool for PHP.

In this post, I’ll take you through why Xdebug is amazing, getting it setup, how to use it, get the most out of it it, and some neat advanced uses all to make your life easier.

He starts with some background on his previous debugging practices and how discovering XDebug revolutionized his workflow. He then talks about breakpoints for debugging and what he calls "debug driven development". The article then walks you through the installation process and the integration with IDEs, specifically PHPStorm. The rest of the post shows examples of how to use XDebug along with breakpoints and IDE features to get more information about the current application state and where things are failing. He also includes sections about using XDebug for profiling and performing remote debugging via an SSH tunnel.

tagged: xdebug introduction debugging profiling tutorial setup ide integration

Link: https://deliciousbrains.com/xdebug-advanced-php-debugging/

SitePoint PHP Blog:
An in-Depth Walkthrough of Supercharging Apps with Blackfire
Jan 14, 2016 @ 17:30:32

The SitePoint PHP blog has a new tutorial posted by Reza Lavaryan showing you how to "supercharge your applications" with the help of the Blackfire.io profiling service.

With profiling, we can spot the performance bottlenecks in the code and do something about them. There is a variety of profiling tools out there, each taking a different approach. [...] With profiling, we can spot the performance bottlenecks in the code and do something about them. There is a variety of profiling tools out there, each taking a different approach. [...] Blackfire.io is the new generation of web profilers, which takes the automatic instrumentation approach, but without imposing a performance impact on our application.

First he defines some of the basic terms it's helpful to know when profiling and using Blackfire. He then walks you through getting what you'll need set up:

  • a Homestead VM instance with the necessary configuration options
  • a script using Faker to generate and write user data to a local database

He then shows you how to execute the first profiling run and what the results look like in the Blackfire views. He uses these results to make some modifications to the script and re-runs the tests to see what kind of gains it provides. Most of his examples use the web interface for the service but the post ends with a look at using the command line tool and getting back some simple metrics as a result.

tagged: profiling performance evaluate blackfireio service introduction faker

Link: http://www.sitepoint.com/an-in-depth-walkthrough-of-supercharging-apps-with-blackfire/

Zend Developer Zone:
Introspecting your Code with Z-Ray for Azure
Jan 13, 2016 @ 18:38:38

On the Zend Developer Zone blog Daniel Berman has posted a guide showing how to use their Z-Ray plugin to inspect code running on Azure for statistics around performance, queries and errors thrown by the code.

Quick experimentation, easy collaboration, automated infrastructure and scalability, together with advanced diagnostic and analytical tools – all provide PHP developers with good reasons to develop in the cloud.

[...] The combination of Z-Ray and the Azure cloud means PHP developers building apps on the Azure web app service get the best of both worlds – Z-Ray’s powerful introspection capabilities and Azure’s rich cloud infrastructure.

The post walks you through the steps to create a new Azure-based web application, how to upload your code and enable the Z-Ray feature directly from the Azure "Tools" menu. The Z-Ray toolbar is then automatically injected into your application for your immediate profiling needs.

tagged: azure microsoft hosting zray profiling tool interface tutorial

Link: http://devzone.zend.com/7093/introspecting-code-with-z-ray-for-azure/

Lakion Blog:
How we sped up Sylius' Behat suite with Blackfire
Dec 01, 2015 @ 18:08:57

On the Lakion blog there's a recent post sharing how they used the Blackfire.io profiling service to [speed up their application's tests] (Behat)(http://lakion.com/blog/how-did-we-speed-up-sylius-behat-suite-with-blackfire) and find the "pain points" to fix.

Feedback time is one of the most crucial factors during development and the red - green - refactor cycle. In case of Sylius, the full build used to take two and a half hour, including 55 minutes for only PHP 5.6 jobs. Waiting so long for feedback is not an option for a project of this size and with so many active contributors. As much as I am Xdebug fan, I have never really used it for profiling - the snapshots generation was slowing down the profiled script significantly and resulted in monstrous files, which weren't easy to read.

Half a year after I have first heard of blackfire.io I decided to give it a try. It resulted in a series of pull requests that speeds up Sylius test suites 6 times and reduces memory usage to one tenth.

They go through some of the major bottlenecks that the service helped them locate including:

  • an issue with the login process and their role evaluation handling
  • problems with time spent doing router initialization
  • Doctrine performance issues running it without a class metadata cache

For each item they describe what the service was reporting and how they corrected it in the application. Most of the changes were relatively small, fortunately. They also link to the results from before and after the changes so you can see the difference. As their environment is Symfony-based they end the post with some other helpful Symfony tips to getting the most out of your application and enhancing its performance in a few simple ways.

tagged: blackfireio behat test suite performance improvement profiling

Link: http://lakion.com/blog/how-did-we-speed-up-sylius-behat-suite-with-blackfire

BitExpert Blog:
Prophiler PSR-7 Middleware
Oct 27, 2015 @ 15:42:54

On the BitExpert blog Stephan Hochdörfer shares a new tool, a PSR-7 compliant middleware, that allow easy integration with your current application of the Prophiler debugging/profiling tool.

Prophiler is a PHP Profiler & Developer Toolbar which is part of the Phalcon project but can also be used as a stand-alone component, kind of like the Symfony Web Debug Toolbar or Z-Ray. What I like about Prophiler is that on the one hand hand it is super easy to install and on the other hand offers a few nice adapters (e.g. PSR-3 logging or Doctrine integration) out-of-the-box.

The middleware is a simple Composer install away. He includes the code you'll need to make the Prophiler instance and how to hook in the middleware for use. His example uses the Zend Framework Stratigility structure but because it's a PSR-7 compliant package, it can integrate just as easily with any PSR-7 framework/library. He also includes a sample of running a request and mentions the automatic addition of the toolbar to the output.

tagged: prohpiler profiling psr7 middleware integration zendframework stratigility tutorial composer

Link: https://blog.bitexpert.de/blog/prophiler-psr-7-middleware/

Adam Culp:
XHProf PHP Profiling
Aug 05, 2013 @ 14:03:35

Adam Culp has posted to his site about some of his experiences with XHProf and profiling his PHP applications.

Today I set up my development environment so I can use XHProf to profile PHP scripts when needed, and it was pretty easy. [...] XHProf is a PECL package, and can be easily installed by using standard PECL commands.

He walks you through the installation of the PECL package (you'll need to use the command line for this one) and how to add the module to your php.ini to enable it. Once you restart your web server, you can start the debugging using the xhprof_enable function and then the xhprof_disable function to end the testing and retrieve the data for processing. He also includes a bit of output from his own pass-through script to show the results.

tagged: xhprof profiling install tutorial debug

Link: http://www.geekyboy.com/archives/718

Kenny Katzgrau's Blog:
Enable Site-Wide Profiling With CodeIgniter
Dec 30, 2010 @ 15:07:33

On his blog today Kenny Katzgrau talks about a handy feature of the CodeIgniter framework - profiling - and how you can implement it site-wide rather than just on a controller by controller basis.

In your controller before you load a view, CodeIgniter will give you information regarding how fast the page loaded, how many SQL queries executed, the content of each query, and the running time of each query. This is incredibly useful when you are trying to debug your application, or simply see how quickly things are loading. There’s only one problem: To enable profiling, that line of code above must be present. What if you want to profile several pages, or even your whole web application?

He turned to another built-in feature of the framework, the controller hooks it allows, to set up a simple post-controller execution that gets a new CodeIgniter instance and enables the profiling configuration item. This is a much better option than having to put the line in each and every controller and method he might want profiled.

tagged: sitewide profiling codeigniter framework tutorial

Link:

ThinkPHP Blog:
Benchmarking & optimizing real-world scenarios in a business context
Jun 18, 2010 @ 14:14:35

On the ThinkPHP blog today there's a new article looking at some of the best practices they seen when it comes to profiling and benchmarking your PHP-based applications.

Over the years, PHP has evolved from a script language to a programming language used in big applications with high-level architectures. As the most popular language for web applications, PHP is very fast, robust and stable by default. Coming from tiny scripts, PHP is used in large-scale web applications nowadays. In terms of business context, we need to focus on these three key factors: Scalability, Responsiveness and Resource misusage. All three factors have a high impact on hardware costs, customer loyalty and - indirectly - sales.

They mention a few ways that you can use to optimize your application's code including evaluating resource limitations, Firebug caching results and finding bottlenecks with something like XDebug.

tagged: profiling benchmarking optimizing business

Link:

ProPHP Podcast:
Newscast for Dec 12th, 2007
Dec 25, 2007 @ 14:13:00

The Pro::PHP Podcast has released their latest episode - the Newscast for December 20th, 2007.

Topics mentioned include:

To grab this latest show you can either subscribe to their feed or you can just get the latest show via a direct mp3 download.

tagged: podcast newscast prophp phpcity java charting google profiling podcast newscast prophp phpcity java charting google profiling

Link:

ProPHP Podcast:
Newscast for Dec 12th, 2007
Dec 25, 2007 @ 14:13:00

The Pro::PHP Podcast has released their latest episode - the Newscast for December 20th, 2007.

Topics mentioned include:

To grab this latest show you can either subscribe to their feed or you can just get the latest show via a direct mp3 download.

tagged: podcast newscast prophp phpcity java charting google profiling podcast newscast prophp phpcity java charting google profiling

Link:


Trending Topics: