diff --git a/bin/tools/file_from_env.php b/bin/tools/file_from_env.php
index e63cda1c4..e0d7c75f2 100755
--- a/bin/tools/file_from_env.php
+++ b/bin/tools/file_from_env.php
@@ -13,12 +13,17 @@
 if ($argc < 2) {
     echo "This script expects two parameters:\n";
     echo "./file_from_env.php ENV_VAR PATH_TO_FILE\n";
-    exit;
+    exit(1);
 }
 
 # Read environment variable
 $content = getenv($argv[1]);
 
+if (!$content){
+    echo "Variable was empty\n";
+    exit(1);
+}
+
 file_put_contents($argv[2], $content);
 
 echo "Done...\n";
\ No newline at end of file