News Feed
Jobs Feed
Sections




News Archive
feed this:

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

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

JavaWorld.com:
Facebook invents a PHP virtual machine
August 08, 2013 @ 10:20:54

On JavaWorld.com there's a new article posted about an update Facebook has made to their HipHop virtual machine (HHVM) version that is supposed to execute PHP nine times faster than its normal rate.

Social networking giant Facebook has taken another step at making the PHP Web programming language run more quickly. The company has developed a PHP Virtual Machine that it says can execute the language as much as nine times as quickly as running PHP natively on large systems.

An engineering manager for Facebook pointed out the goal of the update - "to make PHp run really, really quickly." The HHVM compiles down the PHP code into C and executes it directly, removing the need for the PHP interpreter.

HHVM is the next step for Facebook. Under development for about three years, HHVM actually works on the same principle as the JVM (Java Virtual Machine). HHVM has a JIT (just-in-time) compiler that converts the human readable source code into machine-readable byte code when it is needed. (The previous HipHop, renamed HPHPc, has now been retired within Facebook.)

You can find out more about the HipHop virtual machine over on Facebook.

0 comments voice your opinion now!
facebook virtual machine hiphop vm execution compile

Link: http://www.javaworld.com/javaworld/jw-07-2013/130726-facebook-invents-php-virtual-machine.html

PHPMaster.com:
PhalconPHP Yet Another PHP Framework?
July 30, 2013 @ 09:31:46

On PHPMaster.com there's a new tutorial talking about Phalcon, yet another PHP framework to add to the now long list. There's something different about this one, though. Phalcon sets itself apart by having its base code be inside an installable PHP module.

There's a wide offering of PHP frameworks, from full-stack frameworks containing ORMs, validation components, and loads of HTML helpers, to micro frameworks which go little beyond offering routing functionality. They all claim to be special, either with beautiful syntax, high speed, or good documentation. One of those frameworks is Phalcon. But Phalcon really is quite different compared to the other frameworks; it isn't just another package that you download, rather it's a PHP module written in C. In this article we'll take a brief look at what Phalcon looks like and what makes it so special.

They introduce the framework a bit and include some basic benchmarks (requests per second and time per request) showing the major advantage being a native module has for Phalcon. He then gets into the usage of it - setting up mod_rewrite, creating the project structure and creating the MVC scripts. There's also a brief mention of the Phalcon query language that can be used to interact with the database.

0 comments voice your opinion now!
phalcon framework module compile benchmark performance

Link: http://phpmaster.com/phalconphp-yet-another-php-framework

Brandon Savage:
Compiling PHP 5.5 From Scratch
May 15, 2013 @ 09:48:41

Brandon Savage has a new post to his site today showing you how to compile and install PHP 5.5, the next major upcoming release for the language (in RC status as of the time of this post though).

There's always a lag behind new releases of PHP and releases of packages for operating systems such as Ubuntu. This lag time means that you could be kept from upgrading to the latest and greatest PHP for a year or more, unless you use an outside repository like Dotdeb. [...] Instead, I roll my own version of PHP. It's simple and easy to do, and something that any developer can do. Here's my instructions for doing so on a fresh Ubuntu installation.

He gives a reason or two why you might want to "roll your own" installation and helps you get the environment prepared via some "aptitude" install commands for supporting software. Commands are included for installing needed dependencies, configuring/building PHP and updating Apache to use this new install. He finishes it up with a few smaller things to do like making the php.ini and enabling the Zend opcode caching extension.

0 comments voice your opinion now!
compile language release candidate version tutorial install apache

Link: http://www.brandonsavage.net/compiling-php-5-5-from-scratch

Chris Jones:
Adding DTrace Probes to PHP Extensions
December 07, 2012 @ 09:35:09

In a new post to his site (related to the topic of this previous post) Chris Jones shows you how to setup and use DTrace support in your PHP installation for enhanced debugging abilities.

The powerful DTrace tracing facility has some PHP-specific probes that can be enabled with --enable-dtrace. DTrace for Linux is being created by Oracle and is currently in tech preview. Currently it doesn't support userspace tracing so, in the meantime, Systemtap can be used to monitor the probes implemented in PHP. This was recently outlined in David Soria Parra's post Probing PHP with Systemtap on Linux.

His examples are using the Oracle flavor of linux, but they should work for just about any unix-based system out there. He installs the tool via a yum package and compiles the latest PHP source with the "enable-dtrace" flag. He includes a simple script to connect to an Oracle database and shows the contents of the resulting "functrace.stp". He also shows how he added more "prodbes" (the points DTrace uses to profile) into the OCI8 extension for PHP (steps and source included).

0 comments voice your opinion now!
dtrace extension probe tutorial compile oci8 extension


David Parra:
Probing PHP with Systemtap on Linux
December 05, 2012 @ 10:41:30

David Parra has a new post to his site today about a method of using Systemtap to profile PHP as the code executes (as an alternative when DTrace may not be available.

PHP introduced DTrace support with PHP 5.3, enabling probing points in the PHP executable that can be used to simplify probing of PHP applications without having to the PHP implementation details. We enabled probes on function calls, file compilation, exceptions and errors. But this has always been limited to the operating systems that support DTrace. With the popularity of DTrace, Systemap programmers decided to add a DTrace compatibility layer that allows to use DTrace probes as Systemtap probing points as well.

Thanks to a recent commit to the PHP 5.5 branch, your PHP installation (compiled with DTrace support) can be executed with the "stap" command and searched for probe points. He includes a simple Systemtap script that counts the calls of a specific function to get you started.

0 comments voice your opinion now!
probe profile systemtap dtrace compile tutorial



Community Events











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


language introduction application symfony2 security unittest component install hhvm facebook podcast database package example performance framework release composer hack project

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