Combine and minimize all .js files in parent folder
This snippet at the end...

if (compilingRequired())
{
    if (file_exists($cache_path)){
        unlink($cache_path);    
        unlink($index_path);
    }

    $scripts_in_directory = getScriptsInDirectory();
    $file_handler = fopen($cache_path, 'w+');
    $cache_handler = fopen($index_path, 'w+');

    foreach ($scripts_in_directory as $name)
    {
        if (strlen(file_get_contents($cache_path)) &gt; 0){
            fwrite($file_handler, str_repeat(PHP_EOL, 2));
        }

        fwrite($file_handler, '/**** ' . $name . ' ****/' . str_repeat(PHP_EOL, 2));
        fwrite($file_handler, compressScript(file_get_contents($name)));
        fwrite($cache_handler, $name . PHP_EOL);
    }

    echo file_get_contents($cache_path);
}
else
{
    echo file_get_contents($cache_path);
}


If they both end the same, there's really no need for an else case, you can just put the statement after the if statement.

if (compilingRequired())
{
    if (file_exists($cache_path)){
        unlink($cache_path);    
        unlink($index_path);
    }

    $scripts_in_directory = getScriptsInDirectory();
    $file_handler = fopen($cache_path, 'w+');
    $cache_handler = fopen($index_path, 'w+');

    foreach ($scripts_in_directory as $name)
    {
        if (strlen(file_get_contents($cache_path)) &gt; 0){
            fwrite($file_handler, str_repeat(PHP_EOL, 2));
        }

        fwrite($file_handler, '/**** ' . $name . ' ****/' . str_repeat(PHP_EOL, 2));
        fwrite($file_handler, compressScript(file_get_contents($name)));
        fwrite($cache_handler, $name . PHP_EOL);
    }
}
echo file_get_contents($cache_path);


Ideally, though, it'd read something like

if (compilingRequired())
{
    compile();
}
printCompressedFiles();


Because you want to program on the same level of abstraction - high level code is in "programmer english", describing the actions that need to be done (basically that list of 6 steps of yours, maybe compressed a bit). Low level code is pretty much regular code - code actually doing the work.