diff --git a/src/bindings/php/hammer.i b/src/bindings/php/hammer.i
index 2e19d4eaec504ceb6f1dfe4890507ac12d2ac2b7..318ec3a40ac96ee78066023abbbc7ef1a2d0062b 100644
--- a/src/bindings/php/hammer.i
+++ b/src/bindings/php/hammer.i
@@ -1,4 +1,7 @@
 %module hammer;
+#ifdef ZTS
+  void ***tsrm_ls;
+#endif
 %include "exception.i";
 %{
 #include "allocator.h"
@@ -11,9 +14,6 @@
   %}
 
 %init %{
-#ifdef ZTS
-  void ***tsrm_ls;
-#endif
   h_tt_php = h_allocate_token_type("com.upstandinghackers.hammer.php");
   %}