Login   Register  
PHP Classes
elePHPant
Icontem

Title: Building Custom PHP Extensions

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

  Latest classes All reviews   Building Custom PHP Extensions   Latest classes Latest reviews   Best sellers ranking Best sellers ranking  

Title

Building Custom PHP Extensions

Category

PHP books

Author

Blake Schwendiman

Publisher

Lulu Press

Release date

September 8, 2003

ISBN

1411601882

Sales ranking

Week: 23 All time: 64

Reviews

December 7, 2003 55555 5
  Post a comment Post a comment   See comments See comments   Find where to Buy Now Find where to Buy Now  
Picture of Manuel Lemos
Manuel Lemos
manuellemos.net
One of the reasons why PHP became so popular is that provides a large list of features that solve the needs of the developers that use it, especially for Web development.

Most of the PHP features are provided by functions that are part of modular extensions that can be plugged into the main PHP engine.

The most useful extension modules ship with the normal PHP distribution. Other extensions are available optionally from the PECL repository that is part of the PHP project.

There are also extension modules that are developed by third party developers and are distributed commercially or as Open Source projects.

Anybody can develop new extension modules for PHP, and so provide new functionality that is not yet available or is not provided with all the convenience that the users would like.

For instance, the Turck MMCache extension provides simultaneously the capabilities of caching compiled PHP, optimizing compiled PHP for execution maximization, saving and loading compiled PHP in encoded files and even caching content generated by PHP scripts to minimize the time it takes to be serve PHP generated pages possibly from data sources that are slow to query like databases.

Despite there are similar commercial extensions available, many people prefer to use Turck MMCache because it is Open Source and so it is free to use and to have access to its code.

Usually, these extensions are written in low level languages like C or C++ for maximizing the execution speed.

Most of the extensions that are available are not as complex as caching/encoder/optimizer extensions like Turck MMCache. However, to write new PHP extensions you need to have specific knowledge of how to do it.

Building Custom PHP Extensions is one of the first books to dedicate exclusively to this topic.

Blake Schwendiman, the author, wrote this book because he had the need to develop new functionality for his projects that was not available in PHP. Since he had to invest significantly on studying the subject, he felt that it would be a good idea to share the knowledge that he gained by writing this book.

There is some documentation available in the Internet on how to build extensions for PHP. However, what is available is scarce and in general incomplete. This book covers much more than what is available and is well enough even to build non-trivial PHP extensions.

The interesting part of the book starts with building your first PHP extension from a skeleton generated by a script named ext_skel that is provided with the regular PHP distribution.

The largest chapter of the book focus on the important details about how to do each thing that you may want to do in a normal PHP extension. It covers all the options of the ext_skel script, memory management functions, directory and file access functions, the PHP build system, how to declare functions that you extension makes available to PHP scripts, creating constants, accessing to your extension function arguments and their return values, manipulating variables, extension initialization and finally, how to provide new classes of objects via a new extension.

There is also a chapter that provides a full example with source code for a new extension and another chapter on how to build self-contained extension, i.e. extensions that can be build as shared libraries (.so on Unix/Linux or .DLL on Windows) that can be loaded dynamically.

PHP is not OS specific but most of its development is based on Unix/Linux platforms. Despite of this, this book has a whole chapter on how to build PHP and PHP extensions for Windows, integrating in normal Windows development tools.

This is a valuable book that addresses an important need that many PHP developers have when it comes to how to take the most of PHP applications developing new extensions. Since it covers also the development of extensions on Windows, the author has demonstrated that he is well aware that despite PHP is an Open Source project, the PHP developers are not interested just on Unix/Linux. This way he made this book very complete and very useful to all of those that would like to build new PHP extensions and make PHP an even better language than it is today.
  Post a comment Post a comment   See comments See comments   Find where to Buy Now Find where to Buy Now  

Comments

No comments were submitted yet.

Post a comment

December 26, 2006 55555 5
  Post a comment Post a comment   See comments See comments (1)   Find where to Buy Now Find where to Buy Now  
Picture of Marcelo Santos Araujo
Marcelo Santos Araujo
crosaratech.com.br
Building Custom PHP Extensions is an essential book for everyone that needs to write a PHP extension from scratch.

Despite the fact that it does not cover PHP 5 features, such as the new APIs and revamped OOP features, it is still interesting to developers that have never written an extension before.

It explains how to use generator tools to create extension skeletons, how to compile the extension code, array manipulation, and memory allocation.

It is a good book if you are really interested in diving into the PHP internals easily, but not so deeply.

Overall this is a good introductory book on how to write custom PHP extensions. It is like of a series of how-to documents on this subject.
  Post a comment Post a comment   See comments See comments (1)   Find where to Buy Now Find where to Buy Now  

Comments

1. no source code - peter mcdonald (2007-07-14 19:44)
no source code... - 0 replies
Read the whole comment and replies

Post a comment