Writing a PHP extension in C - part 1

Melanie Rhianna Lewis (10.Jun.2010 at 10:30)
Workshop at Dutch PHP Conference 2010 (English - UK)

Rating: 5 of 5

PHP, PECL and PEAR provides more functionality than you can shake a stick at. Sometimes though you need to add functionality that is not yet provided by the core language or any extension. For example using IO or a C library that is not yet supported, or carrying out some processor intensive computation. In these cases you need to resort to writing your own C extension.

This tutorial comprehensively covers writing PHP extensions in C. It starts with setting up a build environment. It then introduces the basics of C extension development and work through an full example. The example will explain the various PHP data types and how PHP function arguments are handled in C. The tutorial will then move on to more sophisticated areas of extension development such as writing a stream wrapper, implementing PHP classes and using external C libraries. The tutorial will also look at using C++ rather than C as the extension language. It will cover the requirement of thread safety in extensions and explain the macros provided by PHP to support this. Finally it will talk about documentation and the facilities provided by the PHP site for PECL writers such as PECL database and SVN server.

Who are you?

Claim talk

By clicking this button you are declaring that you are the speaker responsible for it and a claim request will be sent to the administrator of the event.

If the claim is approved you will be able to edit the information for this talk.

Are you sure?

 
Comments closed.

Comments

Rating: 4 of 5

10.Jun.2010 at 13:10 by Joshua Thijssen

Good workshop. Melanie started directly with a hands-on experience in compiling a simple extension. Since writing (and understanding) extensions need a certain amount of php internal knowledge, a lot of time was spend on some dry theory (not necessarily a bad thing though!) Melanie knows her stuff and a lot of background information was presented during the workshop.

Really would have liked it to have a classical creation of writing your own extension (for example: creating a string-reverse function, own stream wrapper etc).

Rating: 4 of 5

10.Jun.2010 at 13:46 by Mark van der Velden

Great workshop Melanie explained it very well, although the slides could use some work. Most of them were hard to read, but luckily you had code samples to go with it and read along. She even managed to make a few of us laugh, and thats an impressive accomplishment!

Rating: 5 of 5

10.Jun.2010 at 14:00 by Harrie Verveer

Great tutorial! Melanie covered everything, from the most basic 'hello world' PHP extension to actually explaining how to deal with stuff like ZVALs, hash tables, classes and objects. The learning curve is a bit steep if you've never actually written a PHP extension (like myself) but Melanie explained everything in a very clear way.

Now I've done the tutorial I don't have the feeling that I can write an extension without having an example next to it quite yet, but at least I now know what's going on when I look at the sourcecode of existing extensions, and I know where I can find the building blocks to create my own extension :). Great tutorial overall, I'd recommend it to anyone who wants to learn how to write PHP extensions.

Rating: 5 of 5

10.Jun.2010 at 15:05 by Rowan Merewood

Melanie knows her stuff, so there was a lot of great technical content in here. She's also good at answering questions on the fly while keeping the flow of the presentation. This was particularly useful, as I don't think (as an audience) we quite had the C skills she was initially expecting.

Learned a lot, definitely made the right choice of workshop to attend.

Rating: 5 of 5

11.Jun.2010 at 11:45 by Sam de Freyssinet

Execellent tutorial session, handled expertly by Melanie- logically stepping through the issues in a clear methodical manner. The subject matter is hard to convey traditionally, but Mel ensured all the relevent dependencies where touched upon in a timely manner. Glad I attended!

Rating: 4 of 5

11.Jun.2010 at 11:46 by Ben Longden

Great talk and enjoyable day! Have come out of it feeling that I should be able to navigate my way around the PHP source with a little more understanding of how things work.

Melanie clearly knows her stuff, and was available to answer questions that people had.

If you want to know more about how PHP works and how you can extend it, definitely a good tutorial to attend.

Cloud server hosting by Combell Combell      © Joind.in 2012