PHP 5.3.3 MySQLi compile woes: my_global.h and error: duplicate ‘unsigned’

It seems like every time I re-compile PHP I get some whacky error. Anyway, I was fortunate enough that a quick Googling found a solution from katmai for compile error.

I’m popping this up here as a reminder to my future self, as well as anyone else who stumbles into this.

If you get this error when attempting to compile PHP 5.3.3 with MySQLi on, in my case, Snow Leopard

/usr/local/include/mysql/my_global.h:1008: error: duplicate ‘unsigned’
/usr/local/include/mysql/my_global.h:1008: warning: useless type name in empty declaration

Was solved with a simple patch to ext/mysqli/php_mysqli_structs.h

Index: ext/mysqli/php_mysqli_structs.h
===================================================================
--- ext/mysqli/php_mysqli_structs.h	(revision 301474)
+++ ext/mysqli/php_mysqli_structs.h	(working copy)
@@ -54,6 +54,7 @@
 #define WE_HAD_MBSTATE_T
 #endif
 
+#define HAVE_ULONG 1
 #include <my_global.h>
 
 #if !defined(HAVE_MBRLEN) && defined(WE_HAD_MBRLEN)

View Gist