Have you ever thought about writing your own PHP extension? There are surely a few pro’s and con’s about creating PHP extensions to solve problems, rather than write PHP libraries. But this is not the question here. I was curious. So come on Internet, let’s see what you got for me…
Looks a bit outdated, but that’s not the problem here for me. As a matter of fact, I’m currently still using PHP 5.3.5 on my dev for a list of reasons. And I’m using Windows and I don’t complain (I know my colleagues think I’m weird). Luckily both tutorials cover the topic on how to create the extension on Windows for PHP 5.3.5. So much win! And the best: it really works!
Basically both tutorials provide you with everything you need. I had to get over two pitfalls though:
- php5ts.lib is not in the source code directory I just extracted, but in my WAMP stack already – in my case I located it in C:\xampp\php\dev
- error C2371: ‘socklen_t’ : redefinition; different basic types – I really have no idea why this error came up during compilation. However I was able to “solve” *cough* the problem by commenting out lines 149 to 151 in the php.h:
#ifndef HAVE_SOCKLEN_T typedef unsigned int socklen_t; #endif
Surely not the ideal solution, but as I just wanted to try it out I don’t mind at the moment.