News Feed
Sections




News Archive
feed this:

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

Joe Watkins:
But, is it web scale ?
October 08, 2014 @ 11:16:05

In his most recent post Joe Watkins talks briefly about concurrency in PHP and some of the issues that can come along with it. This includes one of the most glaring: the stress it can put on the host system with even a small number of threads being introduced.

Before we start to cover the topic of how to achieve parallel concurrency in PHP, we should first think about when it is appropriate. You may hear veterans of programming say (and newbies parrot) things like: "Threading is not web scale." This is enough to write off parallelism as something we shouldn't do for our web applications, it seems obvious that there is simply no need to multi-thread the rendering of a template, the sending of email, or any other of the laborious tasks that a web application must carry out in order to be useful. But rarely do you see an explanation of why this is the case: Why shouldn't your blog be able to multi-thread a response ?

He gives an example of a controller request that spawns off just eight threads and imagines what might happen if that controller was requested even just one hundred times (resulting in 800 threads). He does point out at least one place where it could be useful, though: separating out the portions of the application that need to use the parallelism from the rest.

Parallelism is one of the most powerful tools in our toolbox, multicore and multiprocessor systems have changed computing forever. But with great power comes great responsibility; don't abuse it, remember the story of the controller that created 800 threads with a tiny amount of traffic, whatever you do, ensure this can never happen.
0 comments voice your opinion now!
webscale parallelism concurrency process threading

Link: http://blog.krakjoe.ninja/2014/10/but-is-it-web-scale.html

HHVM Blog:
The Journey of a Thousand Bytecodes
October 06, 2014 @ 12:49:38

In the latest post to the HHVM (HipHop VM) blog Sara Golemon recounts the journey of a thousand bytecodes and the process that it takes to decompose a PHP file and optimize it for execution in the HHVM environment.

Compilers are fun. They take nice, human readable languages like PHP or Hack and turn them into lean, mean, CPU executin' turing machines. Some of these are simple enough a CS student can write one up in a weekend, some are the products of decades of fine tuning and careful architecting. Somewhere in that proud tradition stands HHVM; In fact it's several compilers stacked in an ever-growing chain of logic manipulation and abstractions. This article will attempt to take the reader through the HHVM compilation process from PHP-script to x86 machine code, one step at a time.

The process is broken down into six different steps, each with a description and some code examples where relevant:

  • Lexing the PHP to get its tokens
  • Parsing the token results into an AST (and optimizing it along the way)
  • Compilation to Bytecode
  • HHBBC Optimization
  • Intermediate Representation
  • Virtual Assembly
  • Emitting machine code
0 comments voice your opinion now!
hhvm bytecode process hiphop compile decode optimize

Link: http://hhvm.com/blog/6323/the-journey-of-a-thousand-bytecodes

Qandidate.com Blog:
How we manage our development process at Qandidate.com
August 22, 2014 @ 10:34:46

The Qandidate blog has a new post today that "pulls back the curtain" as to how they manage their development process and get their work done.

At Qandidate.com we tried a lot of different project management tools and techniques. After two years of experimenting I want to share our current process, seen from my role as product owner (PO). One reason for sharing this, is to help you improve your process, but the most important reason is to start a discussion with you based on your experience, to improve our process even more. Our main rule at Qandidate.com is to embrace change. Always be open for changes that may or may not improve your process. If a change improves the process it's a win. If you didn't try it you will never know!

They walk through the three main points over the overall flow of work there:

  • The process itself including two week sprints containing (unestimated) stories
  • A demo and stakeholders meeting showing the work they've done during the sprint and get feedback from the stakeholders
  • The stories and how they're created and when/how new ones are added (their "piano meetings").

They also include testing, both frontend and backend, and focus on small chunks of functionality instead of quick and dirty hacks. While their process won't work for every group (and is more of a "scrum-but..." setup) it is interesting to see how another group does their work.

0 comments voice your opinion now!
qandidate manage development process scrumbut stories meeting demo stakeholder

Link: http://labs.qandidate.com/blog/2014/08/21/development-process-at-qandidate-com/

Lorna Mitchell:
Using Phing with Travis CI
July 18, 2014 @ 11:23:45

Lorna Mitchell has a quick post to her site today showing you how to link up Travis-CI and phing to execute the phing build on the Travis-CI service.

We've started using Travis CI on one of my projects to run some build processes to check that everything looks good before we merge/deploy code. One thing I ran into quite quickly was that I wanted to install phing in order to use the build scripts we already have and use elsewhere, but that it isn't provided by default by Travis CI.

To get it all cooperating, she uses the "before_install" settings/functionality Travis provides to use PEAR to discover and install phing. Then in the "script" section, the build can call the phing executable without problems. She does point out one "magic" kind of thing that rehashes the Travis environment and lets to know phing exists: the...well..."rehash" configuration setting.

0 comments voice your opinion now!
phing travisci beforeinstall tutorial build process

Link: http://www.lornajane.net/posts/2014/using-phing-with-travis-ci

ServerGrove Blog:
Symfony2 components overview Process
April 18, 2014 @ 12:41:41

The ServerGrove blog has posted their latest Symfony2 component spotlight, this time focusing on the Process component.

The Symfony2 Process component, allows us to execute commands in sub-processes. [...] The Process component provides an object-oriented abstraction on top of proc_* functions to execute independent processes from PHP.

As with the other posts in the series, they walk you through the installations via Composer and some examples of its use. The post also shows the use of exit codes, working with long running processes and how to execute PHP code in the command. They also briefly look "under the hood" at how the component does what it does (on top of the proc_* functions).

0 comments voice your opinion now!
symfony2 component process external command overview

Link: http://blog.servergrove.com/2014/04/16/symfony2-components-overview-process/

PHPBuilder.com:
Processing JSON in PHP
April 04, 2014 @ 10:40:39

PHPBuilder.com has posted a new tutorial today showing you how to work with JSON in PHP including serialization and database interaction.

This article explains how to use the JavaScript Object Notation (JSON) extension in PHP, going step by step through a series of essential operations. JSON is an object string notation, it is defined as a subset of JavaScript's syntax and its general-purpose is to interchange data format. As you probably know, JSON was first made to be used with JavaScript for accessing remote data, but now it is used by many other languages because JSON data is platform independent data format. JSON can be used natively in JavaScript, but you can also use it in a server-client application logic.

They start with an introduction to the JSON structure and how to both create and encode data using PHP's own json_encode and json_decode. The examples start out using arrays for the data but then move into something slightly more complex - objects. The article talks about JsonSerializable and show how to automatically hook the data into a table and store the content based on the column name/property name match.

0 comments voice your opinion now!
process json encode decode tutorial example

Link: http://www.phpbuilder.com/articles/application-architecture/object-oriented/processing-json-in-php.html

Matthias Noback:
Test Symfony2 commands using the Process component and asynchronous assertions
March 24, 2014 @ 10:49:13

Matthias Noback has a new post today showing you how to test Symfony2 commands that use the Process component. More specifically, his tests revolve around the ones that use asynchronous assertions in the testing to remove weird behaviors that could be caused by multiple processes running them simultaneously.

Usually you would test a console command using the ConsoleTester class as described in the official Symfony documentation. But we can not use it in this case. We need to isolate the process in order for pcntl_fork() to work correctly, otherwise the PHPUnit test runner itself will be forked too, which will have the effect of running all the following unit tests twice (which can have very strange effects on the test results).

He shows how to use the Process component to start up a new process (the daemon) and check that the PID file exists. He includes an example of a "probe" to determine what processes are running and preventing them from stepping on each other.

0 comments voice your opinion now!
symfony2 command process component asynchronous assertion unittest phpunit

Link: http://php-and-symfony.matthiasnoback.nl/2014/03/test-symfony2-commands-using-the-process-component-and-asynchronous-assertions/

Greg Freeman:
Processing data with PHP using STDIN and Piping
November 18, 2013 @ 10:24:56

Greg Freeman has a post today looking at using streams and STDIN in PHP to handling incoming data (like to a CLI script).

PHP streams are still lacking in documentation and are rarely used compared to other PHP features. This is a shame because they can be really powerful and I have used them to gain a lot of performance when doing things such as processing log files. One of the more powerful features of Linux is the ability to pipe in data from another program, it's often faster to offload tasks to an existing linux user space program than to do it in PHP and the added benefit is that you gain multi core processing which is not possible with standard PHP.

He talks briefly about the "pipe" character and how it allows you to send the output from one command to another. He shows how to mimic this same kind of input handling in PHP using the "php://stdin" stream and a fopen function call. He gets a bit more in-depth into how the streams work (blocking) and a bit of configuration and data you can get about the current streams. The post finishes with an example of a non-blocking input handler that will automatically end execution if no data is given within three seconds.

0 comments voice your opinion now!
data process stdin input handling tutorial pipe

Link: http://www.gregfreeman.org/2013/processing-data-with-php-using-stdin-and-piping/

SitePoint PHP Blog:
Introduction to Gearman - Multitasking in PHP
November 04, 2013 @ 13:23:11

The SitePoint PHP blog has posted an introductory tutorial showing you how to use Gearman in PHP to handle multitasking outside of the normal script execution. Gearman is an external job server that lets you schedule scripts and tasks for execution.

How many times have you developed a web application that had some functionality which would benefit from running an external program or even forking a separate process? This is not something you generally like to do from your web app because you want to make it run as fast and efficient as possible, while keeping the site functional for end users. So how do we get a fast but full-featured application that can process more than the average app we're used to?

They start by introducing you to Gearman - the server side - and how it works to handle a large amount of jobs quickly (50 thousand per second according to the article). They give the example of resizing images uploaded by users to illustrate. Next up is the installation - first Gearman then on to the PHP side, installing the PECL extension and adding it to the php.ini configuration. An example script is also provided showing how to create a new connection to Gearman and configure the callbacks for handling status changes. They also include adding two kinds of tasks - a normal one and a low priority one.

0 comments voice your opinion now!
tutorial gearman introduction install configure process task

Link: http://www.sitepoint.com/introduction-gearman-multi-tasking-php/

Community News:
PHP-FIG Voting on PSR-4 Opened
September 20, 2013 @ 12:18:31

The PHP-FIG has officially started the voting process for the PSR-4 autoloading standard that would provide an interface to make autoloading a bit more standardized across applications.

The purpose is to specify the rules for an interoperable PHP autoloader that maps namespaces to file system paths, and that can co-exist with any other SPL registered autoloader. This would be an addition to, not a replacement for, PSR-0.

The current autoloading standard definition (PSR-0) still allows for the use of the underscore in class names to resolve to directory paths in the application's files. In this new standard, that allowance is gone, relying only on the actual namespacing to define package pathing. This "package-oriented autoloading" is set to help move PHP package development forward into a more standardized structure.

0 comments voice your opinion now!
psr4 voting process open member autoload definition

Link: https://groups.google.com/forum/#!topic/php-fig/NWfyAeF7Psk


Community Events





Don't see your event here?
Let us know!


interview series tips framework list symfony language community opinion laravel deployment zendserver update introduction podcast install api library package release

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework