exec () function calls program in the background

1

I am making a manager for my Online Game so that team members can start emulators.exe through the site, but I am having a problem, emulators open in the background (VPS)

Then I would like to know if you have how to do the emulators normally, opening the executable window and not staying in the background.

<?php
if($_POST['emulador'] == "Ligar")
{
    exec("start D:\Servidor\Center\Gerenciador\ligar.bat");
    echo "<script>alert('Emulador Ativado!');</script>";
}
?>
    
asked by anonymous 17.01.2018 / 20:43

1 answer

0

I was introduced to this solution

if(!function_exists('pcntl_exec'))
{
    function pcntl_exec($path,$args=array())
    {
        if(is_string($args)) $args = array($args);
        if(count($args)) $path = sprintf('"%s"', $path);
        $shell = new COM('WScript.Shell');
        $shell->run($path.(count($args) ? ' '.implode(' ',$args) : ''),0,true);
    }
}
switch ($_POST['Center'])
{
    case "Ligar":
        pcntl_exec('D:\Servidor\Center\Gerenciador\ligar.bat');
        echo "<script>alert('Emulador Center Ativado!'); location.href='http://127.0.0.1/pt/?page=manager';</script>";
    break;
}

However, does it continue to open in the background, any ideas?

    
21.01.2018 / 21:25