php-fpm on Solaris 9 Sparc

If  any one was trying to use php-fpm knows that on Sparc platform have seen: “unsupported processor. please write a patch and send it to me”.

Php-fpm is a great project, so I decided to write my own patch for php 5.2.10 – you can download it here.

Mainly I’ve added necessary assembler code in /sapi/cgi/fpm/fpm_atomic.h for Sparc platform.  Patch also solves issues which I found on my Solaris 9 :

-broken switching between systems with inttypes.h or  stdint.h – I added #if HAVE_INTTYPES_H directives in few places

-if system doesn’t have unsetenv() function it won’t compile – I added #ifndef HAVE_UNSETENV and my implementation of this function in /sapi/cgi/fpm/fpm_env.c if wasn’t in system

-in /sapi/cgi/fpm/fpm_env.c setenv() function wasn’t working properly – on my solaris 9 was adding some stupid data do ENV, I don’t know if it was ok or not on other systems. I’ve rewritten it in other way.

– when /libevent/libevent.a was compiling no proper /libevent/event-config.h was generated. It was a problem when for example system doesn’t have stdint.h – I  added this file in
/libevent/Makefile.in like this “libevent.a: event-config.h $(libevent_a_OBJECTS) $(libevent_a_DEPENDENCIES)”  and changed order in /sapi/cgi/Makefile.frag to: “$(SAPI_CGI_PATH): $(PHP_GLOBAL_OBJS) $(SAPI_EXTRA_DEPS) $(PHP_SAPI_OBJS)

Now as I tested everything compiles and work on Solaris 9 Sparc even in 64bit mode. I’m using it on site with about 250 000 shows per day and for now have no problems. It should be universal for all platforms now! 🙂