Ensure that /init cannot be called more than once (#34)

diff --git a/core/php7.1Action/router.php b/core/php7.1Action/router.php
index 63e3a75..3c24ff3 100644
--- a/core/php7.1Action/router.php
+++ b/core/php7.1Action/router.php
@@ -91,6 +91,11 @@
  */
 function init() : array
 {
+    // check that we haven't already been initialised
+    if (file_exists(ACTION_CONFIG_FILE)) {
+        throw new RuntimeException('Cannot initialize the action more than once.', 403);
+    }
+
     // data is POSTed to us as a JSON string
     $post = file_get_contents('php://input');
     $data = json_decode($post, true)['value'] ?? [];
diff --git a/core/php7.2Action/router.php b/core/php7.2Action/router.php
index 6a2c570..890d55c 100644
--- a/core/php7.2Action/router.php
+++ b/core/php7.2Action/router.php
@@ -122,6 +122,11 @@
  */
 function init() : array
 {
+    // check that we haven't already been initialised
+    if (file_exists(ACTION_CONFIG_FILE)) {
+        throw new RuntimeException('Cannot initialize the action more than once.', 403);
+    }
+
     // data is POSTed to us as a JSON string
     $post = file_get_contents('php://input');
     $data = json_decode($post, true)['value'] ?? [];
diff --git a/tests/src/test/scala/runtime/actionContainers/Php7ActionContainerTests.scala b/tests/src/test/scala/runtime/actionContainers/Php7ActionContainerTests.scala
index 8ac62c7..000d0b0 100644
--- a/tests/src/test/scala/runtime/actionContainers/Php7ActionContainerTests.scala
+++ b/tests/src/test/scala/runtime/actionContainers/Php7ActionContainerTests.scala
@@ -95,6 +95,15 @@
     },
     enforceEmptyOutputStream)
 
+  testInitCannotBeCalledMoreThanOnce("""
+          |<?php
+          |function main(array $args) : array {
+          |    echo 'hello stdout';
+          |    error_log('hello stderr');
+          |    return $args;
+          |}
+          """.stripMargin)
+
   it should "fail to initialize with bad code" in {
     val (out, err) = withPhp7Container { c =>
       val code = """