Ilia AlshanetskyZendCon - Profiling with XHProf (30.10.2014, 14:54 UTC)
My slides from ZendCon 2014 on "Profiling with XHProf" are now available for download here:
SitePoint PHPThe 100 Year Old Trick to Writing at 240 Words Per Minute (30.10.2014, 02:20 UTC)

Stenotype machine

Ever seen one of these badboys? This was some serious state-of-the-art tech in 1912 -- the stenotype machine.

If you haven't come across one in real-life, you've most likely seen them in TV or movies. In courtroom dramas there's often a primly-dressed woman to one side quietly tapping away at what looks like a baby typewriter.

Stenography is still a specialist skill that requires significant training and practice to master, but that is still in high demand.

The stenotype machine has just 22 keys and no spacebar. Rather than typing each letter to build a word, stenographers use key combinations -- much like chords on a piano -- that can trigger much longer words.

How stenography works - chords versus strokes.

Originally stenographers produced rolls of coded shorthand that were later manually converted to plain text. Today's more advanced machines handle the conversion in realtime.

Beside court reporting, stenographers are often used in live captioning of television, as well as other general business situations.

While there are friction points to learning stenography, there's a good reason why stenographers take on the expensive tuition fees, the steep learning curve and the overpriced hardware (top-end machines are over $4,000).  

Stenography is fast. Really fast.

A good stenographers can cruise along at 240 words per minute with 99.9% accuracy. That's a single mistake every four pages.

Ok. And I care..., why?

About four years ago, stenographer Mirabai Knight came to the conclusion that stenography had been a walled garden for too long -- controlled and marginalized by big companies. She set about creating her own affordable hardware and open source sofware designed to set stenography free to the masses.

This system -- called Plover -- can be used by book authors, journalists, bloggers and -- importantly for us -- coders and developers in our daily work!

Continue reading %The 100 Year Old Trick to Writing at 240 Words Per Minute%

Ulf WendelPECL/mysqlnd_ms needs updates for MySQL Group Replication (30.10.2014, 00:41 UTC)

‘Synchronous’, multi-master, auto-everything – that’s the new MySQL Group Replication (IPC14 talk/slides) in simple words. After torturing PHP developers for decades with MySQL Replication there is now a new replication option which does not require read-write splitting. A system that does not know about slave lags and reading stale data. In theory, MySQL Group Replication is just about the perfect approach to run a standard PHP application (WordPress, Drupal, …) on a small cluster (3-7 nodes) in LAN settings. In theory, MySQL Group Replication improves both availability and performance.

MySQL Group Replication talk given today at the International PHP Conference 2014 (Munich)

Distribution Transparency

When designing replication systems there are some desireable goals which contradict each other. In a perfect world, from a developers perspective, a database cluster would behave exactly the same way as a single database. The user should never have to worry where and how data is stored in the cluster. Transactions executed on the cluster would provide the same properties like transactions run on a standalone database. The cluster would never return stale data (synchronous).

Synchronous replication is desired but it requires coordination among cluster nodes. In LAN settings coordination can be reasonably fast. MySQL Group Replication is ‘synchronous’ replication (see slides for details). Deploy it on LAN only. In the internet, in WAN settings, when trying to replicate from Europe to Asia things will be slow. If WAN, then either forget about distribution transparency or performance. If WAN, go for asychronous MySQL Replication.

The extra work different clusters cause for the developer

Synchronous and asynchronous clusters always cause some extra work for the developer. Either approach requires load balancing and failover logic. An asynchronous approach adds: dealing with delays and stale reads. MySQL Replication is not only asynchronous but has only one master (primary). This adds: read-write splitting.

PECL/mysqlnd_ms tries to help with all these tasks and take them over in a semi-transparent way.

PECL/mysqlnd_ms support for synchronous clusters

PECL/mysqlnd_ms is a plugin for mysqlnd. PDO_MySQL and mysqli use mysqlnd as their default library to talk to MySQL. Any of the two APIs works with PECL/mysqlnd_ms, our load balancing and replication plugin.

The plugin monitors many API calls and aims to make using any kind of MySQL clusters easier. No matter what cluster: MySQL Replication, MySQL Cluster, MySQL Group Replication, 3rd party solutions. Example configurations are given in the PHP manual.

MySQL Group Replication usage task 1: load balancing

When moving an application from a single database server to a synchronous cluster there are two additional tasks: load balancing and failover. With PECL/mysqlnd_ms load balancing does no require any code changes. The plugin intercepts your connect calls and tests whether the host you connect to matches the name of a config entry. If so, the plugin loads the config, learns from the config which nodes there are and starts load balancing connection. Should you be too lazy to change the host name in your connects to match a PECL/mysqlnd_ms config entry, then just name the config entry after you current host names, have a config entry for ’′ etc.

$link = new mysqli("myapp", ...);

MySQL Group Replication usage task 2: failover

The second task is to handle the failure of a cluster node and connect to the next available one. PECL/mysqlnd_ms does that for you if you want. It picks an alternative from the config and connect you to it.

There’s a small feature gap here. MySQL Group Replication tries to be an auto-everything solution. It automatically detects failed nodes. It also fully automates adding new nodes to the cluster. That’s cool but it means that over time the set of nodes can change and your config needs to be updated.

The PECL/mysqlnd_ms feature gap

There are two options. First, you could deploy the config. Second, af

Truncated by Planet PHP, read more at the original (another 1228 bytes)

Brandon SavageDuplication of effort and NIH (29.10.2014, 16:07 UTC)
The PHP community is engaged in a discussion on whether or not developers should spend time writing new packages that solve existing problems with existing solutions. Ian Landsman uses Laravel as an example of a framework that wouldn’t have existed if nobody ever pushed the envelope of package development. While I agree that Laravel has […]
SitePoint PHP5 Easy Ways to Get Started with PHP on Vagrant (29.10.2014, 16:00 UTC)

Vagrant is a tool for creating and managing virtual environments that help many developers not have to care about the “works on my machine…” problem. Vagrant creates reusable development systems that can be used again and again, helping you keep your system clean of too many installations.

When you are focused on development and lack the skills of a sys admin, the best thing to do (if you are going to use Vagrant during development) is to try another way of setting up your Vagrant configuration.

When it comes to PHP development, there are some online services that simplify the setup and configuration of these Vagrant virtual machines. Here is a list of some of these services.

Continue reading %5 Easy Ways to Get Started with PHP on Vagrant%

Anthony FerraraFoundations Of OO Design (29.10.2014, 16:00 UTC)
It's quite easy to mix up terminology and talk about making "easy" systems and "simple" ones. But in reality, they are completely different measures, and how we design and architect systems will depend strongly on our goals. By differentiating Simple from Easy, Complex from Hard, we can start to talk about the tradeoffs that designs can give us. And we can then start making better designs.

Read more »
Christopher Jones"PL/SQL: The Scripting Language Liberator" - video recording now available (29.10.2014, 15:35 UTC)

Oracle University has released a video from Oracle OpenWorld of a great session by Steven Feuerstein and myself. We walked through a PHP application, showed some application tuning techniques for Oracle Database, and then looked at improving the use of Oracle Database features to aid performance and scalability, and also easily add features to the application.

The official blurb was:

PL/SQL: The Scripting Language Liberator: While scripting languages go in and out of favor, Oracle Database and PL/SQL persist, managing data and implementing business logic. This session walks through a web application to show how PL/SQL can be integrated for better logic encapsulation and performance; how Oracle's supplied packages can be used to enhance application functionality and reduce application complexity; and how to efficiently use scripting language connection and statement handling features to get better performance and scalability. Techniques shown in this session are applicable to mobile, web, or midtier applications written in languages such as JavaScript, Python, PHP, Perl, or Ruby on Rails. Using the right tool for the right job can be liberating.

The video is free for everyone. Lots of the other good content in the Oracle Learning Streams is available via subscription, if you're interested.

SitePoint PHPIncrease Productivity with Komodo: an Extensible, Multi-language IDE (29.10.2014, 15:00 UTC)

This article is sponsored by Komodo IDE. Thank you for supporting the sponsors who make SitePoint possible!

As unglamorous as it sometimes is, it’s undeniable that most of a developer’s time is spent inside an editor, writing code. Think about it: You'll use your coding tool for hours every day at work, and then at home for coding side projects. That can be 30 hours a week, if not more.

With this in mind, it’s really important to make that editor space as comfortable, helpful, and useful as possible. To get to that point, you really need a reliable, well-established Integrated Development Environment, rather than just a code editor with syntax highlighting and a few simple plugins.

IDEs are much more than just code editors. They provide a whole development toolset. From code debuggers, integrated version control — supporting the most popular software such as Git, SVN, Mercurial — to unit testing environments, where you can have a framework automatically set up. Bonus points go to any IDE that can really let you make yourself at home, by allowing you to customize the environment to conform to the way you work best.

While most powerful IDEs boast some or all of these features, they’re often restricted to a specific platform. You’ll typically need to buy a license for each operating system you choose to develop in. A costly proposition, but fortunately not one that applies to all IDEs.

Komodo IDE stands out by offering a single license that can be used across all platforms — Windows, OS X and Linux — to develop a wide variety of languages. You don’t need to waste money buying a separate license key for each one, and you don’t need to worry about compatibility or being forced to put up with the particular quirks of one platform. Komodo also offers plenty of customization and extensibility, as well as top-notch version control and debugging services.

Komodo IDE website

In this article I’ll review Komodo IDE version 8, outline its features and advantages, and you’ll learn how this software can help you in writing better code and to be a more productive developer.

For the screenshots displayed below, I used Komodo’s “Abyss” skin after having customized Komodo to my liking.

How Komodo IDE can help you

Komodo IDE is a cross-platform IDE that supports most of the major programming languages in use today, such as PHP, Ruby, Node.js, and Python. The IDE also crosses the boundary into front-end, with support for HTML, CSS and JavaScript.

Its “cross-platform” nature means you can run the software on all major operating systems, OS X, Windows and Linux. This is nice if you work in a team and team members use different operating systems.

These cross-platform capabilities stem from Komodo’s implementation of the Mozilla engine, the same framework that powers equally-cross-platform browser Firefox.

More and more companies are making their software free for the open-source world and for educational institutions and ActiveState, the team behind Komodo IDE, is no different, with a range of licensing options available for individuals/freelancers, companies, and open source projects. Head over to the website and download a free trial.

ActiveState, the company behind Komodo IDE, also offers a free and open-source version of the software, cutting out all the advanced features, leaving you with a powerful, stripped-back code editor.

Key features of Komodo IDE

Komodo IDE has a balanced selection of features, with everything you’d expect from an IDE while avoiding becoming a software behemoth.

Besides the editor, the IDE has a debugger, a "toolbox" version control system integration, team collaboration, and powerful code intelligence with autocomplete and intelligent code refactoring.



Komodo has a powerful debugging engine with all the features you’d expect, such as viewing the call stack, breakpoints, remote debugging, and an interactive shell.

To start the debugger go to Debug -> Go/Continue or Debug -> Step In. By default the Debug Options window will appear, where you can configure the debugger environment, like select the programming language, set up environment variables or insert additional arguments.

Currently Komodo supports Perl

Truncated by Planet PHP, read more at the original (another 2377 bytes)

Pascal MartinPHP versions statistics - October 2014 (29.10.2014, 06:00 UTC)

Cet article est aussi disponible en français.

You can follow me @pascal_martin, and there is an RSS feed of the posts I write in English.

I have collected data and written about usage of each PHP versions a few times already — up until now, always in French: this is the first time I’m doing this in English. The first time I’ve done this was in September 2011 and the most recent one was almost one year ago, in November 2013. At that time, PHP 5.2 was still representing 34.4% of PHP installations, with PHP 5.3 ahead with 48.7%.

The data presented in this post have been collected during the week-end of October 2014 18th. Stable versions of PHP are PHP 5.4.34 (which is called old-stable), PHP 5.5.18 and PHP 5.6.2. PHP 5.3 is not maintained anymore, since August 2014 14th and PHP 5.2 has been out of support for almost 4 years.

Web Servers

Before talking about PHP versions, here’s the list of web-servers I identified the most often while collecting data:

  • Apache: 5,644,243 — 58.65%
  • IIS: 1,496,967 — 15.56%
  • nginx: 1,410,170 — 14.65%
  • Others: 456,985 — 4.75%
  • GSE: 312,448 — 3.25%
  • cloudflare-nginx: 134,131 — 1.39%
  • LiteSpeed: 107,378 — 1.12%
  • Oversee Turing v1.0.0: 61,127 — 0.64%

As a graph only representing the first few results:

Apache is still in the first place — and by far — but it loses ground bit by bit, especially to nginx, which rose in one year from 7.9% to 14.8%. IIS remains at the second place, but could very well fall down one step before my next post!

Major versions of PHP

When it comes to major versions of PHP, there is no real surprise:

  • PHP 3: 415 — 0.02%
  • PHP 4: 106,866 — 4.15%
  • PHP 5: 2,470,731 — 95.84%
  • PHP 6: 36 — 0.00%
  • PHP 7: 3 — 0.00%

PHP 5 is first in line, far from the other versions1 — which is, let’s admit it, quite logical.

Still, a great number of servers are still running PHP 4 — its last version having been released in August 2008.

Minor versions of PHP

Going on with minor versions of PHP, for PHP >= 3.x and PHP <= 7.x and only keeping versions that have been detected at least 10 times, we’d get the following data:

  • PHP 3.0: 402 — 0.02%
  • PHP 3.2: 12 — 0.00%
  • PHP 4.0: 834 — 0.03%
  • PHP 4.1: 1,823 — 0.07%
  • PHP 4.2: 1,967 — 0.08%
  • PHP 4.3: 22,537 — 0.87%
  • PHP 4.4: 79,702 — 3.09%
  • PHP 5.0: 2,500 — 0.10%
  • PHP 5.1: 39,144 — 1.52%
  • PHP 5.2: 586,490 — 22.75%
  • PHP 5.3: 1,141,116 — 44.26%
  • PHP 5.4: 583,423 — 22.63%
  • PHP 5.5: 113,582 — 4.41%
  • PHP 5.6: 4,464 — 0.17%
  • PHP 6.0: 34 — 0.00%

And, as a graph:

Truncated by Planet PHP, read more at the original (another 19415 bytes)

Ilia AlshanetskyZendCon - Deep Dive into Browser Performance (29.10.2014, 00:11 UTC)
My slides from ZendCon 2014 about "Deep Dive into Browser Performance" are now available for download here:
LinksRSS 0.92   RDF 1.
Atom Feed   100% Popoon
PHP5 powered   PEAR
ButtonsPlanet PHP   Planet PHP
Planet PHP