I'm trying to send some commands to a Debian server and these commands take up to 30 seconds to complete which is fine but whenever someone on my webserver clicks the button (which tells php to run the commands with phpseclib) the entire website just freezes (it just keeps loading and loading if you try accessing it) until either all the commands have been ran or until timeout.
Code
$this->_ssh = new Net_SSH2($this->_ip);
if(!$this->_ssh->login($this->_username, $this->_password))
die('Could not connect with SSH: Login failed!');
$cd_to_subdir_command = 'cd ' . $this->_path . "
";
$rmdir_command = '[ -d ' . $this->_screen . ' ] || rm -rf ' . $this->_screen;
$mkdir_command = 'mkdir ' . $this->_screen;
$extract_command = 'tar -xzf hlds_no_amxx.tar.gz -C ' . $this->_screen . "
";
$chmod_command = 'chmod -R 777 ' . $this->_screen . "
";
$this->_ssh->read(':~$');
$this->_ssh->write($cd_to_subdir_command . "
");
$this->_ssh->write($rmdir_command . "
");
$this->_ssh->write($mkdir_command . "
");
$this->_ssh->write($extract_command . "
");
$this->_ssh->write($chmod_command . "
");
$this->_ssh->setTimeout(30); // 30 seconds timeout to give it time to extract because the file is really big
$this->_ssh->read();
I need the webserver not to do this because obviously 30 second loading times are a pain and not to mention only 1 user would be able to do stuff at a time.