Execute gnome-terminal from remote server
<p>Alright, so I have a VPS running with gnome-terminal, and I'm using the following php script execute commands on the remote server.</p>

<pre><code>&lt;?php
include('Net/SSH2.php');
$ssh = new Net_SSH2('IP address');
if (!$ssh-&gt;login('root', 'rthtrhtrhrthrthrth')) {
    exit('Login Failed');
}

echo $ssh-&gt;exec('gnome-terminal -e java -jar run.jar --window-with-profile=b1dcc9dd-5262-4d8d-a863-c897e6d979b9');
?&gt;
</code></pre>

<p>Which when I run the script I get the following error</p>

<blockquote>
  <p>** (gnome-terminal:1952): WARNING **: Could not open X display Failed to parse arguments: Cannot open display:</p>
</blockquote>

<p>I'm trying to get it to run a command from a remote server which will execute in gnome-terminal and open the jar file. Pretty much when the shell command is executed on my remote server, connects to ssh and runs the gnome-terminal command to open up a desktop application on that VPS.</p>

<p>Is this possible or am I doing something wrong?</p>

<p>UPDATE</p>

<p>In Putty I've gotten it to work by issueing the following commands</p>

<pre><code>export DISPLAY=:1
gnome-terminal -e "java -jar file.jar"
</code></pre>

<p>But still trying to execute it with my web server using </p>

<pre><code>&lt;?php
include('Net/SSH2.php');
$ssh = new Net_SSH2('IP address');
if (!$ssh-&gt;login('root', 'rthtrhtrhrthrthrth')) {
    exit('Login Failed');
}
echo $ssh-&gt;exec('export DISPLAY=:1');
echo $ssh-&gt;exec('gnome-terminal -e "java -jar run.jar"');
?&gt;
</code></pre>

<p>I'm still getting the error where it cannot open X display. I'm only trying to pass this to the VPS, not display anything on the web server</p>