<?php
require_once(__DIR__.'/classes/task.class.php');

$tasks = [];

// Load tasks from json
$tasks_arr = json_decode(file_get_contents(__DIR__.'/tasks.json'), true);
foreach ($tasks_arr as $task_arr) {
	$task = new Task($task_arr);
	$tasks[] = $task;
}

// Run tasks
while (true) {
	foreach ($tasks as $task) {
		if (!$task->isRunning() && $task->shouldRun()) {
			$task->run();
		}
	}

	echo 'Mem: '.number_format(memory_get_usage())."\n";
	sleep(1);
}
<?php
require_once(__DIR__.'/classes/task.class.php');

$tasks = [];

// Load tasks from json
$tasks_arr = json_decode(file_get_contents('tasks.json'), true);
foreach ($tasks_arr as $task_arr) {
	$task = new Task($task_arr);
	$tasks[] = $task;
}

// Run tasks
while (true) {
	foreach ($tasks as $task) {
		if (!$task->isRunning() && $task->shouldRun()) {
			$task->run();
		}		
	}

	echo 'Mem: '.number_format(memory_get_usage())."\n";
	sleep(1);
}
--- 
+++ 
@@ -4,7 +4,7 @@
 $tasks = [];
 
 // Load tasks from json
-$tasks_arr = json_decode(file_get_contents('tasks.json'), true);
+$tasks_arr = json_decode(file_get_contents(__DIR__.'/tasks.json'), true);
 foreach ($tasks_arr as $task_arr) {
 	$task = new Task($task_arr);
 	$tasks[] = $task;
@@ -15,7 +15,7 @@
 	foreach ($tasks as $task) {
 		if (!$task->isRunning() && $task->shouldRun()) {
 			$task->run();
-		}		
+		}
 	}
 
 	echo 'Mem: '.number_format(memory_get_usage())."\n";
Read self dir for config
