Archive for the ‘PHP’ Category

The Sleeper Awakens

Tuesday, May 1st, 2012

This will be my first blog post in a very long time. Life has been busy and, in my day job, productive. Unfortunately this has meant that activities outside of work have been somewhat curtailed. But today I am ‘bunking off’ early as it is the monthly PHP NW meeting in Manchester so I am on a train heading across the country to it. This is giving me a chance to write this! (more…)

Enumerating note data in Flickr using PHP

Friday, September 24th, 2010

Flickr provides a comprehensive API to access its data. It also has a very neat notes facility that allows you to add notes to a region of an image which pop-up when you mouse over the relevant area. Flickr provides API calls to add, edit and delete notes but not to enumerate notes associated with an image. To do that you have to do a little more work.

(more…)

DPC 2010

Thursday, July 15th, 2010

A couple of weeks ago I went to the Dutch PHP Conference 2010 and I had an amazing time. The event was held in Amsterdam at the RAI centre. The primary sponsor was iBuildings and the entire event was organised by the totally awesome Lornajane.

When DPC 2010 announced the call for papers I submitted both a proposal for a tutorial on PHP extensions and one for a talk on web services. Both were excepted. I had proposed both half day and full day versions of the tutorial the organisers chose the full day version. This turned out to be a lot of work. Basically I would be talking for 6 hours in four 90 minute slots.
(more…)

DPC2010 – “PHP Extensions Tutorial” and “Web Services For Consumer Devices”

Saturday, June 12th, 2010

I am still at the Dutch PHP Conference and very enjoyable it is too. I have now given my two talks. The first was an all day session on writing PHP extensions in C. The second was a regular 45 minute session on Web Services For Consumer Devices.

PHP Extensions

This tutorial covered writing PHP extensions from the very beginning right through to writing objects and classes in C. I think this went well. Its a lot for beginners to cover so naturally some people got lost towards the end but I have had some good feedback. Links to the slides and examples are below.

Slides PHPExtensions-Final-20100612.pdf
Example – Hello World hello_world-20100612.tgz
Example – Hello World (Extended) hello_world_extended-20100612.tgz
Example – Memory Stream memory_stream-20100612.tgz
Framegrab (PECL) http://pecl.php.net/package/framegrab

Web Services For Consumer Devices

This talk covered what to consider when writing a service to be used by an application on a consumer devices. I agree with the commenters who felt it was a little light. Yes it needs revision before it gets reused.

WebServicesForConsumerDevices-20100612.pdf

DPC – Dutch PHP Conference 2010

Thursday, April 22nd, 2010

Rather belatedly I am delighted to announce that I have been accepted to speak at the Dutch PHP Conference in Amsterdam this June. DPC is the premier European PHP conference and is sponsored by iBuildings.

I will be running a tutorial Writing a PHP extension in C and speaking about Web Sevices for Consumer Devices. I look forward to seeing you there.

Capturing still images from video devices in PHP using Framegrab

Sunday, February 28th, 2010

I found I had a need to capture and process still video images from video devices using PHP so I wrote the Framegrab PECL extension. This post introduces the basics of Framegrab.
(more…)

Serial IO in PHP using the DIO extension

Monday, February 15th, 2010

DIO is the Direct IO extension for PHP. I recently took over maintaining this extension and have implemented comprehensive stream support for both POSIX and Windows systems. To demonstrate the use of DIO this post will describe a PHP script that sends an SMS using a USB 3G modem.
(more…)

PHP DIO Extension: Looking for beta testers

Tuesday, February 2nd, 2010

A few months ago I had a need to do some serial IO from PHP. After asking around I found out there was a PHP extension for this but it was unmaintained, unowned and out of date. To cut a long story short I ended up as the maintainer of said extension and since them I have been fixing and extending it.

The original DIO API is very basic and POSIX oriented. Serial support is not very configurable and doesn’t work at all on Window platforms. So I have been working on implementing PHP stream extensions that allow you to do raw and serial IO via streams. Anyway its ready for testing by people other than me on POSIX (Linux, OS X etc) and Windows platforms so I’m looking for beta testers.

(more…)

Building PHP C extensions on Ubuntu 9.10

Tuesday, December 1st, 2009

I have just taken over maintenance of the PECL Direct IO extension as it has been unmaintained for a while. Naturally the first thing I did before writing any new code was to check out the extension from SVN and try and build it. Building the source was fine but when I tried make test it failed producing output like the following:

PHP Warning:  PHP Startup: Unable to load dynamic library 'modules/gd.so' - 
modules/gd.so: cannot open shared object file: No such file or 
directory in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/gd.so' - 
modules/gd.so: cannot open shared object file: No such file or 
directory in Unknown on line 0

The default PHP package on Ubuntu 9.10 is fairly minimalist. Most extensions are provided as separate packages which include an INI file and a dynamic library. The dynamic library is stored in:

/usr/lib/php5/20060613+lfs

And the INI file for each extension is in:

/etc/php5/conf.d.

The make tests rule in the generated Makefile in the extension you are compiling modifies the path that PHP searches for extensions by to point to the modules directory within the extension source. So PHP, which is used to run the tests, cannot find the extensions.

I’ve found the easiest way (if slightly hacky) to fix the make test failure is just to copy the .so files from the PHP5 extension directory in to the modules directory within the extension source.

Installing eclipse for multiple programming languages

Friday, November 20th, 2009

I can do almost everything I need to do in OS X but just occasionally I need Linux. So I recently installed a VirtualBox VM running Ubuntu 9.10. I use Eclipse as my favoured IDE since I can run it on all three of the major OSes and it has good support for C, C++ and Java which is what I use mostly for work. So the next thing for me was to install Eclipse. This is where things became interesting.
(more…)