Archive for the ‘Optimizations’ Category

Running PHP on NFS: version 1.3 of turbo_realpath extension.

Monday, May 13th, 2013

Here’s a new version of the turbo_realpath extension which solves the performance problems with PHP applications and NFS storage. This is mainly a maintenance release that adds support for the latest versions of PHP like 5.4 and 5.5. (more…)

How to create PHP extensions – part II: Introduction to PHP variables

Thursday, August 4th, 2011

In one of my previous articles I explained how to build a PHP extension, and how to declare a simple function in C. I demonstrated how to return data from the C function to the script in PHP. But I have not explained how to pass the arguments to the function, nor how to change the values of existing PHP variables.

In order to do so, I have to introduce you the internal ZVAL data structure used by PHP engine to store the PHP variables. (more…)

Running PHP on NFS: version 1.2 of turbo_realpath extension

Tuesday, July 12th, 2011

I proudly present new version of my PHP extension which solves the performance problems with PHP application and NFS storage. This version adds support for safe_mode = on setting. (more…)

How to create PHP extensions – part I: simple functions

Thursday, July 7th, 2011

There are some situations when every developer encounters limitations in PHP. For some, the problem is performance, for others the lack of specific, low-level functionality.

In that cases, the only solution is to write your own PHP extension that adds the missing features to the language.

Unfortunately, although the documentation of the PHP language itself is excellent, the information on the programming of the PHP engine are rudimentary.

In this series of articles I will try to show you, how to write the PHP extensions and describe some of the Zend engine features. (more…)

How to compile PHP scripts?

Wednesday, July 6th, 2011

In an earlier article I described how to install HipHop for PHP translator that allows compilation of the PHP scripts.

This time, I will describe different types of compilations, so that it is possible to build both simple scripts and large systems written in PHP. (more…)

Running PHP on NFS: new version of turbo_realpath extension

Friday, July 1st, 2011

More than a month has passed since I published my PHP extension fixing the performance issues with NFS and PHP. Since then, turbo_realpath has become quite popular among Web administrators. Unfortunately, despite my warnings, many of them don’t disable the PHP functions responsible for creating links and symlinks, or do it wrong way.

For this reason I decided to publish a new version of the turbo_realpath extension, which adds the ability to automatically disable dangerous functions in PHP. (more…)

Drupal HH7 project: HipHop for PHP and Drupal 7.4 compatibility patch

Thursday, June 30th, 2011

Another month, another Drupal 7 version. Drupal 7.4 was released some days ago so it’s my turn to announce the next version of Drupal 7.x patch adding support for HipHop for PHP source code transformer.

Drupal HH7 Version: 1.2
Release date: 30-06-2011
Compatible with: Drupal 7.4
Not compatible with: HipHop branches 36a16fb and 6044908 and Drupal 7.0-7.2
Tested on HipHop branch: 806ee06 and earlier

Modules compatibility list can be found at the end of this article. Please report any patch issues in the comments to this annoucement. (more…)

phpMultiServer, a high-performance HTTP server written in pure PHP

Tuesday, June 14th, 2011

This is a sample, high-performance HTTP server written in pure PHP.

Thanks to various optimizations, this server is able to handle more than 800 HTTP requests/second on a dual core laptop (Core 2 Duo 1.6Ghz).

This in turn allows you to create highly efficient PHP scripts with low response times (less than 1ms latency between sending request to launching PHP script).

In result this software is sometimes faster than the Apache HTTP Server (which is written in highly efficient C language). (more…)

Eval() counterparts in PHP: how to do something wrong faster?

Monday, June 13th, 2011

Probably all PHP developers know what is the eval() command, and why it should be avoided.

There are several reasons, but mainly the problem is the safety and efficiency of the script. An additional disadvantage may be lack of support by the compilers of PHP code (for example, HipHop for PHP).

Unfortunately, there are situations where it is necessary to execute dynamically created code. In this article I will focus on performance and faster replacement of eval() command. (more…)

Download VMware image of Fedora 14 Linux with HipHop for PHP installed

Friday, June 10th, 2011

Many articles on this blog describes the performance and functionality of HipHop. Since many readers like the dry facts, I decided that I prepare an image of Linux distribution, which will have a built-in support to PHP code translator. (more…)

Running PHP on NFS: huge performance problems and one simple solution.

Thursday, June 2nd, 2011

Drupal, Joomla and other popular PHP scripts use a PHP language constructs called include_once() and require_once(). This constructs includes other PHP files, but only once. In order to do so, it differentiates between files with their full path using the lstat system call.

Unfortunately this leads to a lot of lstat calls which are not cached using NFS. This in turn can slow down larger PHP applications even tenfold. (more…)

Drupal HH7 project: HipHop for PHP and Drupal 7.2 compatibility patch

Tuesday, May 31st, 2011

Drupal 7.2 was released about five days ago. Today, I’m proud to announce the next version of Drupal 7.x patch adding support for HipHop for PHP source code transformer.

Drupal HH7 Version: 1.1
Release date: 30-05-2011
Compatible with: Drupal 7.2
Not compatible with: HipHop branches 36a16fb and 6044908 and Drupal 7.0-7.1
Tested on HipHop branch: 806ee06 and earlier

Modules compatibility list can be found at the end of this article. Please report any patch issues in the comments to this annoucement. (more…)

Drupal 7: Download HipHop for PHP’s compatible source codes!

Thursday, May 19th, 2011

As promised in a previous article I give you source codes of Drupal 7 which are compatible with HipHop for PHP source code transformer.

This version of the patch has been successfully tested on a minimum base installation of Drupal 7.0. At the moment I can not guarantee the correct operation of other versions of Drupal. Subsequent patches will add support for additional modules should they prove to be defective during the futher test process.

There is also a new version of patch which is compatible with Drupal 7.2, read this article for futher info.

Please report any patch issues in the comments to this story. (more…)