Reputation: 1
I will launch a bash scrip for php. the echo of my bash displays the correct code syntax but does not launch ...
#!bin/bash
var1=$1
var2=$2
config=$("xfreerdp /v:server.domain.tld /u:$1 /p:$2 /load-balance-info:\"tsv://ms terminal services plugin.1.programmes_remot\")
eval "$config"
I turn your senses after my php code
system("/var/www/test/./script.sh $var1 $var2");
I just tested the method 2 no error but its not launch xfreerdp this is what I put
$cmd='xfreerdp /v:server.domain.tld /u:'.$var1.' /p:'.$var2.' /f /cert-igore -menu-anims /network:lan load-balance-info:"tsv://MS Terminal Services Plugin1.Programmes_Remot"';
exec('export display=guilinuxbox:0.0 $cmd');
but this does not launch
Upvotes: 0
Views: 1317
Reputation: 917
A slash is missing in the she-bang: #!/bin/bash
Anyway, your script seems rather complicated. You could just write:
#!/bin/bash
xfreerdp /v:server.domain.tld /u:$1 /p:$2 /load-balance-info:\"tsv://ms terminal services plugin.1.programmes_remot\"
or call xfreedb
directly in your PHP script:
$var1 = escapeshellarg($var1);
$var2 = escapeshellarg($var2);
system("xfreerdp /v:server.domain.tld /u:$var1 /p:$var2 /load-balance-info:\"tsv://ms terminal services plugin.1.programmes_remot\"");
Note, that you should always escape the variables that you put in a shell command for security reasons.
Edit:
Ah okay, it’s a GUI/X11 application. Are you running the PHP script on a Web server? Add 2>&1
to the command line string like this system("... 2>&1")
to see any error messages in the HTML output.
I guess, you also need to explicitly grant access to the screen.
Upvotes: 1