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

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

Anthony Ferrara:
Introducing Recki-CT
September 01, 2014 @ 10:56:46

Anthony Ferrara has introduced an interesting new tool in his most recent post, a compiler toolkit for PHP: Recki-CT.

Over 1.5 years ago, I introduced PHPPHP to the world. It was the first implementation of the PHP language written in PHP itself. But PHPPHP suffered from a few problems which relegated it to toy status (such as performance). Today, I get to introduce you to another implementation of PHP, written in PHP. But this one is no toy. This one... This one is fun...

He goes on to introduce the tool, pointing out what it is (and isn't) and how it compiles the PHP down into machine code. He covers the difference between it and things like HHVM and some benchmarks on how fast the resulting code performs. He also gives some thanks to people who helped him along the way (as well as sone of the projects it relies on). If you're interested in finding out more, check out the project's GitHub page for complete info and the latest version.

0 comments voice your opinion now!
reckict project compile language phpphp

Link: http://blog.ircmaxell.com/2014/08/introducing-recki-ct.html

Lorna Mitchell:
Compiling PHP Extensions
August 29, 2014 @ 09:28:42

Lorna Mitchell has posted a quick guide to compiling PECL extensions to her site today. This is for those users on unix-based systems that might need to manually compile with some custom options (or may be working on your own extension and may just need to test it).

There are lots of reasons why you might like to compile your own PHP extensions. [...] I haven't seen a really approachable guide anywhere, we tend to speak of extensions in hushed tones, and actually it isn't particularly tricky so here is my quick how-to guide.

The process is relatively simple for those familiar with the command line and the steps involved in compiling software. There's some special PHP-only steps you'll have to take before compiling the code to make sure it's ready to be a PHP extension. Then it's up to the usual configure+make_make install to ensure the .so file is correctly generated.

0 comments voice your opinion now!
compile extension tutorial phpize module

Link: http://www.lornajane.net/posts/2014/compiling-php-extensions

SitePoint PHP Blog:
How to Install PHP Extensions from Source
June 30, 2014 @ 11:50:22

PHP extensions (from PECL) can be very handy when you need them. Unfortunately, not all distributions come with packages that will install them for you...this is where compiling comes in. On the SitePoint PHP blog Bruno Skvorc has posted a guide to compiling extensions from source to help you get started.

Sometimes it's hard to know which PHP extensions you'll need before you install PHP. In cases where you need to add extensions later on, you might get lucky and the extension could be in the repository of the OS you're using. [...] What if there's no such thing for other extensions, though? In this tutorial, we'll go through installing some custom extensions on Linux systems (and OS X - the process is nearly identical).

He uses a Laravel Homestead instance as a platform for his example and shows the compilation of the MongoDB for PHP driver. He walks you through the process of booting up the VM and getting the environment/required packages installed. He then shows the process for the installation of two different kinds of PHP extensions: internal and third-party. Finally he shows you how to update your configuration, load in the compiled extension and test it (in this case looking at the phpinfo() to ensure it's loaded).

0 comments voice your opinion now!
install extension source compile tutorial introduction

Link: http://www.sitepoint.com/install-php-extensions-source/

SitePoint PHP Blog:
Help Develop PHP 5.6 RC1 on Homestead
June 23, 2014 @ 11:08:01

In this new post from the SitePoint PHP blog Bruno Skvorc puts out a "call to action" for the PHP developers out there to help develop and test out PHP 5.6RC1 (the current 5.6 release candidate) with the Laravel Homestead virtual machine.

Last week we talked about Laravel Homestead, a prepared local development environment for PHP built on Vagrant by Taylor Otwell, meant to serve as a common starting point for all Laravel (and possibly other PHP) projects. [...] A week before that, we talked about the end of beta for 5.6, and the beginning of the RC program. [...] In this post, we'll have a quick look at how we can install it over the regular PHP in Laravel Homestead and report the build feedback back to the QA site.

He refers to the other article for installation instructions and quickly gets into the steps needed to download and install the RC1 version. There's a few dependencies to install before you compile, but with a few commands it should be off and running quickly. Screenshots are provided to show you the output each step of the way too. If all goes well, the output of a "php -v" command line call will show the successful build of PHP 5.6.0RC1.

0 comments voice your opinion now!
homestead releasecandidate testing compile install tutorial laravel

Link: http://www.sitepoint.com/help-develop-php-5-6-rc1-homestead/

SitePoint PHP Blog:
Getting Started with PHP Extension Development via Zephir
April 09, 2014 @ 10:26:22

The SitePoint PHP blog has posted an introductory tutorial helping you get started with extension development with Zephir, a language that aims to make extension development easy and fast.

This tutorial will explain how to create a PHP extension using a new language: Zephir, which is similar to C and Fortran. You can download the full source code from github. We've touched on the concept of Zephir before, so if you're interested in getting a broad overview, see our previous articles. Zephir can be looked at as a hybrid language that lets you write code that looks like PHP, but is then compiled to native C, meaning you can create an extension from it and come away with very efficient code.

He starts with a list of dependencies you'll need to get an extension compiled and working with Zephir including the gcc compiler and json-c. He shows you how to install Zephir from Github and update your path to make the executable available. As his example extension, he creates a tool that can calculate the result for the time-dependent Schrödinger equation (don't worry, the complete Zephir code for the extension is included in the tutorial). He includes the commands to initialize the Zephir project, code for the various classes involved and the expected output from the compilation. Finally, he includes a bit of PHP code to test out the newly built extension and its output.

0 comments voice your opinion now!
tutorial zephir extension language compile equation

Link: http://www.sitepoint.com/getting-started-php-extension-development-via-zephir/

SitePoint PHP Blog:
Installing PHP Extensions on Nitrous.io
March 03, 2014 @ 11:45:22

On the SitePoint PHP blog Bruno Skvorc has posted a new tutorial showing you how to get PHP extensions installed on Nitrous.io, an online environment combining an IDE and PaaS hosting.

Inspired by a comment on my previous article, I realized Nitrous was still a bit too complicated to customize properly. In this tutorial, we'll glide through installing cURL and Phalcon on a Nitrous.io PHP box.

He continues on from his previous article and shows how to detect cURL support and how to build it from the PHP source into an extension. He helps you get the source for the older PHP version Nitrous.io has installed and the commands you'll need to build the extension. With it installed and enabled in the php.ini, he also installs the Phalcon extension.

0 comments voice your opinion now!
nitrousio tutorial install extension curl phalcon compile

Link: http://www.sitepoint.com/installing-php-extensions-nitrous-io

Nikita Popov:
Fast request routing using regular expressions
February 19, 2014 @ 09:03:07

In his latest post Nikita Popov talks about routing and regular expresions. He also shares some work he's done to create a fast request router using them in "userland" code instead of a C extension.

Some time ago I stumbled on the Pux routing library, which claims to implement a request router that is many orders of magnitude faster than the existing solutions. In order to accomplish this, the library makes use of a PHP extension written in C. However, after a cursory look at the code I had the strong suspicion that the library was optimizing the wrong parts of the routing process. [...] To investigate the issue further I wrote a small routing library: FastRoute. This library implements the dispatch process that I will describe below.

He includes some benchmarks against the results from a C-based routing engine showing his solution performing slightly better. What he's really talking about, though, is the dispatch process in general, not just his implementation. He talks about "the routing problem" many engines face - having to loop through a potentially large set of routes to find a match. He offers an alternative using regular expressions and compiling all of the routes down into one large expression. He includes a simple implementation of the method and reruns the same benchmarks with some different results. He offers one potential solution for speeding it up using "chunked expressions" to break it down into more manageable matching. He includes benchmarks for this last solution as well, showing a slight improvement.

0 comments voice your opinion now!
regularexpression routing dispatch engine chunk compile

Link: http://nikic.github.io/2014/02/18/Fast-request-routing-using-regular-expressions.html

Padraic Brady:
Zephir Language Write PHP Extensions The Easy Way (Without C) - Part 1 Introduction
January 20, 2014 @ 12:16:44

In the new post to his blog Pádraic Brady starts a series looking at building PHP extensions "the easy way" using the Zehpir language, a derivative of PHP.

When I first heard about the Phalcon framework for PHP, my immediate reaction was to doubt the sanity of its developers. Part of that reaction is something most of us would share: we are not C programmers and that strange alien language sometimes terrifies us. [...] Now, with no padded cell yet in evidence, the Phalcon people decided to do something truly insane. They created an intermediate programming language called Zephir, easily learned by any PHP programmer, that makes creating and maintaining the PHP extensions you do create ridiculously easy.

Zephir is a "bridge" making it easier to create the C code required to build a PHP extension but with the more familiar format we're used to as PHP developers. He includes a simple "Hello World" example and talks about some of the differences between it and PHP. He also briefly talks about some of the things Zephir can't do right now and how it relates to the HipHop Virtual Machine (HHVM) and what advantages it might have over it.

0 comments voice your opinion now!
zephir compile c language series introduction extension

Link: http://blog.astrumfutura.com/2014/01/zephir-language-write-php-extensions-the-easy-way-without-c-part-1-introduction/

Lukas Smith:
The future of PHP .. at a distance
December 17, 2013 @ 10:18:02

In his latest post Lukas Smith looks at what he sees coming for PHP and its community as well as some thoughts about the current state of the language and ecosystem around it.

To me it feels like PHP development has become much better structured. It also feels like the RFC process has enabled an influx of new contributors that previously simply didn't know how to get their stuff in. [...] The beauty of clearer processes is that it can also help in clearer delegation, which can lead to subgroups within an open source organization that again have an inner circle of 10-20 really active people.

He suggests, however, that this whole structured process could be "turned upside down" in the coming year or so by things like the HHVM from Facebook and some of the things it would "fix" as a compiler of PHP code. He points out one of the issues with this approach, though - that Facebook (and the HHVM developers) could start to be in control of the evolution of PHP. It does bring up an interesting idea though...that with HHVM compiling code, PHP "extensions" could just become userland code and wouldn't need to be written in C as they'd just be compiled down anyway.

So in conclusion there are lots of reasons to be excited about HHVM's impact on the PHP community. But we should also ensure that in the process the community does not become dependent on a commercial entity.
0 comments voice your opinion now!
future language hhvm facebook compile opinion extension

Link: http://pooteeweet.org/blog/0/2259#m2259


Community Events





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


interview version framework install package community composer security laravel opinion release symfony voicesoftheelephpant update introduction library tool language podcast series

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