У меня есть этот код для запуска команды и печати вывода в реальном времени, проблема в том, что код после команды system()
не выполняется.Как я могу решить эту проблему?
function disable_ob() {
// Turn off output buffering
ini_set('output_buffering', 'off');
// Turn off PHP output compression
ini_set('zlib.output_compression', false);
// Implicitly flush the buffer(s)
ini_set('implicit_flush', true);
ob_implicit_flush(true);
// Clear, and turn off output buffering
while (ob_get_level() > 0) {
// Get the curent level
$level = ob_get_level();
// End the buffering
ob_end_clean();
// If the current level has not changed, abort
if (ob_get_level() == $level) break;
}
// Disable apache output buffering/compression
if (function_exists('apache_setenv')) {
apache_setenv('no-gzip', '1');
apache_setenv('dont-vary', '1');
}
}
function build() {
$location = "build/" . date("Y-m-d-h-i-sa");
echo "Build started! Your build location is " . $location;
$url = "http://{$_SERVER['HTTP_HOST']}";
$escaped_url = htmlspecialchars( $url, ENT_QUOTES, 'UTF-8' );
echo "\nIf you don´t get redirected after build go to $escaped_url/" . $location . "/smefs-Indigo-Remastered-master/Release/smef.pw.dll\n";
echo "...\n";
mkdir($location, 0777, true);
dircpy("","buildfiles/smefs-Indigo-Remastered-master",$location . "/smefs-Indigo-Remastered-master",true);
copy("buildfiles/buildscript.bat",$location . "/buildscript.bat");
copy("buildfiles/JunkCode.exe",$location . "/JunkCode.exe");
#shell_exec('call ' . $location . "/buildscript.bat");
system('call ' . $location . "/buildscript.bat");
# THIS CODE NOT EXECUTED
echo "\n\n# BUILD COMPLETED #";
echo "If you aren´t redirected please go to this link to download build: " . $location . "/smefs-Indigo-Remastered-master/Release/smef.pw.dll";
header('Location: '. $location . "/smefs-Indigo-Remastered-master/Release/smef.pw.dll");
}