diff --git a/api.php b/api.php
index 6b4083be4e3ce64efb92b7b3e1d849769e222c01..cd39ba3222eb3c1e15f56140afbaa3325c6fe30a 100644
--- a/api.php
+++ b/api.php
@@ -324,7 +324,13 @@ foreach ($testCases as $test) {
                 $showTestRunnerDebugOutput = $config['showTestRunnerDebugOutput'];
             }
 
-            $_result = do_compile($arg_mainFileNameWithExtension, $fullWorkingDirPath, $compileCmd, $sourceFileExtensions, $requestDistinctionString, $showTestRunnerDebugOutput);
+            try {
+                $_result = do_compile($arg_mainFileNameWithExtension, $fullWorkingDirPath, $compileCmd, $sourceFileExtensions, $requestDistinctionString, $showTestRunnerDebugOutput);
+            }catch (Exception $e) {
+                //critical error, abort execution (all other tests are likely to fail)
+                output($status_code_InternalServerError, "error executing regex test: " . $e->getMessage());
+                goto handleCleanup;
+            }
 
             $result = array(
                 $s_testServerCode => $status_code_Ok,
@@ -351,9 +357,16 @@ foreach ($testCases as $test) {
             $showTestRunnerDebugOutput = $config['showTestRunnerDebugOutput'];
         }
 
-        //no need to write any files ... can all be handled in memory
-        //$_result = do_regexTest_json($arg_allFiles, $testContent);
-        $_result = do_regexTest_format2($arg_allFiles, $testContent, $showTestRunnerDebugOutput);
+        try {
+            //no need to write any files ... can all be handled in memory
+            //$_result = do_regexTest_json($arg_allFiles, $testContent);
+            $_result = do_regexTest_format2($arg_allFiles, $testContent, $showTestRunnerDebugOutput);
+        } catch (Exception $e) {
+            //critical error, abort execution (all other tests are likely to fail)
+            output($status_code_InternalServerError, "error executing regex test: " . $e->getMessage());
+            goto handleCleanup;
+        }
+
 
         $result = array(
             $s_testServerCode => $status_code_Ok,
@@ -366,6 +379,7 @@ foreach ($testCases as $test) {
             $s_protocol => formatOutput($_result[$s_output]) # the conversation protocol
         );
         array_push($testResults, $result);
+
     } else if ($arg_command === $s_command_blackBoxTest || $arg_command === $s_command_justRunTest) {
 
         if ($isDebug) {
@@ -509,14 +523,20 @@ foreach ($testCases as $test) {
                 $showTestRunnerDebugOutput = $config['showTestRunnerDebugOutput'];
             }
 
-            $_result = do_blackBoxTest($arg_mainFileNameWithExtension, $test, $fullWorkingDirPath,
-                $min_timeout, $min_memoryLimit, $min_diskSpaceLimit,
-                $compileCmd, $execCmd, $sourceFileExtensions, $needCompilation,
-                $maxLinesToRead, $maxErrLinesToRead, $maxLinesToWrite,
-                ($arg_command === $s_command_justRunTest),
-                $requestDistinctionString,
-                $showTestRunnerDebugOutput
-            );
+            try {
+                $_result = do_blackBoxTest($arg_mainFileNameWithExtension, $test, $fullWorkingDirPath,
+                    $min_timeout, $min_memoryLimit, $min_diskSpaceLimit,
+                    $compileCmd, $execCmd, $sourceFileExtensions, $needCompilation,
+                    $maxLinesToRead, $maxErrLinesToRead, $maxLinesToWrite,
+                    ($arg_command === $s_command_justRunTest),
+                    $requestDistinctionString,
+                    $showTestRunnerDebugOutput
+                );
+            } catch (Exception $e) {
+                //critical error, abort execution (all other tests are likely to fail)
+                output($status_code_InternalServerError, "error executing black box test: " . $e->getMessage());
+                goto handleCleanup;
+            }
 
         }
 
diff --git a/bootstrap.php b/bootstrap.php
index 05dc1c25010714f1cad1836471ac980719b3c61e..6408c7ec1ce5696d0b884358821cdab204a623ad 100644
--- a/bootstrap.php
+++ b/bootstrap.php
@@ -69,5 +69,14 @@ $config['maxLinesToRead'] = $row['maxLinesToRead'];
 $config['maxErrLinesToRead'] = $row['maxErrLinesToRead'];
 $config['maxLinesToWrite'] = $row['maxLinesToWrite'];
 $config['showTestRunnerDebugOutput'] = $row['showTestRunnerDebugOutput'] === '1';
+$config['environmentVars'] = $row['environmentVars'];
+
+//parse environmentVars
+if (isset($config['environmentVars'])) {
+    $keyValuePairs = explode("\n", $config['environmentVars']);
+    $config['environmentVarsParsed'] = $keyValuePairs;
+} else {
+    $config['environmentVarsParsed'] = NULL;
+}
 
 return $config;
\ No newline at end of file
diff --git a/constants.php b/constants.php
index 66a69e0f9fbe085724c42cc4de8af6d039cf82e0..c1913df275892928a5691da27bad8116c732e06e 100644
--- a/constants.php
+++ b/constants.php
@@ -3,7 +3,7 @@
 # variables
 
 //use this to know which version we published
-$versionString = '1.0.0';
+$versionString = '1.0.1';
 $rootDirNameToUseString = 'work';
 
 $isDebug = false; //logs debug to STDOUT
diff --git a/do_blackBoxTest_func.php b/do_blackBoxTest_func.php
index f91df7e46e61e992d3d4386a21ad4350dcd8498a..165bb4df256ebd3fe0121a0e71fad9f6f7da0af1 100644
--- a/do_blackBoxTest_func.php
+++ b/do_blackBoxTest_func.php
@@ -120,8 +120,11 @@ function do_blackBoxTest($mainFileNameWithExtension, $test, $fullWorkingDirPath,
         $time_pre = microtime(true);
     }
 
+
+    $env = $config['environmentVarsParsed'];
+
     # without bypass_shell it won't work on windows
-    $process = proc_open($longCmd, $pipesDescriptor, $pipes, NULL, NULL, array('bypass_shell' => TRUE));
+    $process = proc_open($longCmd, $pipesDescriptor, $pipes, $fullWorkingDirPath, $env, array('bypass_shell' => TRUE));
 
 //    $state = proc_get_status($process);
 //    warn('open pid: ' . $state['pid']);
@@ -150,7 +153,7 @@ function do_blackBoxTest($mainFileNameWithExtension, $test, $fullWorkingDirPath,
     }
 
     if ($isDebug && (isset($errorOutput) && trim($errorOutput)!=='')) {
-        debug("error during execution of the test runner: " . $errorOutput);
+        debug("error during execution of the (blackbox) test runner: " . $errorOutput);
     }
 
 
diff --git a/do_compileTest_func.php b/do_compileTest_func.php
index b1ade84213f8857b2e9874b7708eaac96749779d..a512888bdbfa2992376947926de8a6fe50b077c7 100644
--- a/do_compileTest_func.php
+++ b/do_compileTest_func.php
@@ -21,6 +21,7 @@ function do_compile($mainFileNameWithExtension, $fullWorkingDirPath, $compileCmd
 )
 {
 
+    global $isDebug;
     global $config;
     global $s_output;
     global $s_return_val;
@@ -41,16 +42,18 @@ function do_compile($mainFileNameWithExtension, $fullWorkingDirPath, $compileCmd
         . ' "' . ($showTestRunnerDebugOutput === TRUE ? 1 : 0) . '"'              # arg[6] showTestRunnerDebugOutput
     ;
 
-    exec($longCmd, $output, $return_var);
 
-    /* could also be used...proc_open only works if bypass_shell is true??
+    $env = $config['environmentVarsParsed'];
+//    exec($longCmd, $output, $return_var);
+
+    /* could also be used...proc_open only works if bypass_shell is true??     */
     $descriptorspec = array(
         0 => array('pipe', 'r'), # stdin is a pipe that the child will read from
         1 => array('pipe', 'w'),  # stdout is a pipe that the child will write to
         2 => array("pipe", "w")
     );
 
-    $process = proc_open($longCmd, $descriptorspec, $pipes, NULL, NULL, array('bypass_shell' => TRUE));
+    $process = proc_open($longCmd, $descriptorspec, $pipes, $fullWorkingDirPath, $env, array('bypass_shell' => TRUE));
 
     if (is_resource($process)) {
 
@@ -62,7 +65,10 @@ function do_compile($mainFileNameWithExtension, $fullWorkingDirPath, $compileCmd
 
         $return_var = proc_close($process);
     }
-    */
+
+    if ($isDebug && (isset($errorOutput) && trim($errorOutput)!=='')) {
+        debug("error during execution of the (compile) test runner: " . $errorOutput);
+    }
 
     return array(
         $s_return_val => $return_var,
diff --git a/readme.md b/readme.md
index c08f0dfa974764c89d384b4e7467f51bea659cc7..962ac45ca37e252c76ad596e3e6426853acfe3b1 100644
--- a/readme.md
+++ b/readme.md
@@ -278,6 +278,8 @@ The commands will probably require the users files (code). This files can be acc
 
 - all files need an extension else they are ignored
 - if the main file has no extension then code 100 is returned and the program is not compiled/executed  
+- any `compile` and `exec` commands will be interpret by the test server (the unix user who executes the test server) so when you 
+  e.g. set `compile` to `\"echo\" \"$PATH\"` then `$PATH` will be resolved by the unix user and the test runner gets `/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games...`
 
 #### Example (windows)
 internalName (primary key) | compile | exec | hardTimeoutInMs | hardMemoryLimitInKb | hardDiskSpaceLimitInKb | extensions
@@ -331,12 +333,14 @@ Columns (the same as in the local config except the db specific settings)
 * maxLinesToRead
 * maxErrLinesToRead
 * maxLinesToWrite
+* environmentVars
 
 
 #### Example
-id | workingDirFullPath | hardGlobalTimeoutInMs | maxParallelTests | maxNumberOfTestsWithOneRequest |runner | showTestRunnerDebugOutput | maxLinesToRead | maxErrLinesToRead | maxLinesToWrite
---- | --- | --- | --- | --- | --- | --- | --- | ---
-1 | /Users/janis/Documents/Test/ | 2000 | 10 | 15 | "/Users/janis/Misc/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java" -Dfile.encoding=UTF8 -cp "/Users/janis/Documents/Projects/SyndromAll/Syndrom_DefaultTestRunnerFullThreaded/out" Main | 0 | 500 | 500 | 500
+
+id | workingDirFullPath | hardGlobalTimeoutInMs | maxParallelTests | maxNumberOfTestsWithOneRequest |runner | showTestRunnerDebugOutput | maxLinesToRead | maxErrLinesToRead | maxLinesToWrite | environmentVars
+--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
+1 | /Users/janis/Documents/Test/ | 2000 | 10 | 15 | "/Users/janis/Misc/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java" -Dfile.encoding=UTF8 -cp "/Users/janis/Documents/Projects/SyndromAll/Syndrom_DefaultTestRunnerFullThreaded/out" Main | 0 | 500 | 500 | 500 | USER=yapextester\nHOME=/home/yapextester\nPWD=\nLANG=de_DE.UTF-8\nPATH=/usr/local/bin:/usr/bin:/bin:/ 
 
 
 
@@ -378,8 +382,20 @@ A json object with the following properties (order does not matter)
 * **dbConfigName** : (string) -''- but for the config table
 * **dbConfigUser** : (string) -''- but for the config table
 * **dbConfigPw** : (string) -''- but for the config table
-* **dbConfigTableName**: (string) the table name with the configuration (the *dbServer* and *dbName* options are used) 
-
+* **dbConfigTableName**: (string) the table name with the configuration (the *dbServer* and *dbName* options are used)
+
+* **environmentVars** : (string, \n separated, key value pairs are separated by = OR NULL) the environment variables for the test runner. All environment vars are cleared and only these are set (even if this is the empty string). The special delimiters `\n` and `=` must not be used inside keys or values. 
+  The test runner is called and these environment variables are set.
+  You can use `"path""` to escape paths or other strings
+  It is recommended that you at least specify the following: `PWD, USER, HOME ,PATH`
+  * `USER` is the executing user e.g. `yapextester`
+  * `HOME` is the home path for the executing user e.g. `/home/yapextester`
+  * `PWD` is the current path e.g. `/opt/yapex/TestServer` or empty (string)
+  * `LANG` the lang to use (e.g. for default formatting) e.g. `de_DE.UTF-8`
+  * `PATH` are the paths that unix/windows should include when searching for e.g. programs `/usr/local/bin:/usr/bin:/bin:/`
+  **Note** that this is for linux, windows handles environment variables differently (e.g. other multi value  separator than `:`)
+  The test server splits in `\n` and uses these lines as input for proc_open
+  * If the value is `NULL` then the environment variables from the php process are used. However, e.g. fast process manager (fpm) for php will discard environment variables by default. So the result might be different than expected.
 
 If the test server cannot connect to the db then an error (db issue) is returned (so the local config is NOT used!)
 
@@ -398,7 +414,9 @@ If the config table has more than 1 row, the first row is taken!
     "maxParallelTests": 50,
     "hardGlobalTimeoutInMs": 2000,
     "maxNumberOfTestsWithOneRequest": 20,
-    "runner": "\"C:\\Program Files (x86)\\JetBrains\\IntelliJ IDEA 14.1.4\\jdk1.8.0_65\\bin\\java\" -cp \"C:\\Users\\theju\\Documents\\WebProjects\\SyndromeAll\\DefaultTestRunner\\out\\production\\DefaultTestRunner\" Main"
+    "runner": "\"C:\\Program Files (x86)\\JetBrains\\IntelliJ IDEA 14.1.4\\jdk1.8.0_65\\bin\\java\" -cp \"C:\\Users\\theju\\Documents\\WebProjects\\SyndromeAll\\DefaultTestRunner\\out\\production\\DefaultTestRunner\" Main",
+    
+    "environmentVars": "USER=yapextester\nHOME=/home/yapextester\nPWD=\nLANG=de_DE.UTF-8\nPATH=/usr/local/bin:/usr/bin:/bin:/"
 }
 ```
 
diff --git a/stats.php b/stats.php
index 2cfeb45a52c0046ecdf319d1f36493118269dcd8..67d04c10a6ee6f3675bf244aa00ffb9d302bbfba 100644
--- a/stats.php
+++ b/stats.php
@@ -19,6 +19,7 @@ $response = array(
     "maxLinesToRead" => $config["maxLinesToRead"],
     "maxErrLinesToRead" => $config["maxErrLinesToRead"],
     "maxLinesToWrite" => $config["maxLinesToWrite"],
+    "showTestRunnerDebugOutput" => $config["showTestRunnerDebugOutput"],
 
     "dbServer" => $config["dbServer"],
     "dbName" => $config["dbName"],
@@ -26,6 +27,8 @@ $response = array(
     "useConfigFromDb" => $config["useConfigFromDb"],
     "dbConfigServer" => $config["dbConfigServer"],
     "dbConfigName" => $config["dbConfigName"],
+
+    "environmentVars" => $config["environmentVars"],
 );