The app is some sort of obscure proprietary keygen that returns results to stdout.
I am using Ubuntu 12.04.3 Server 32bits, wine version 1.4 and xvfb
I operate my server with ssh only. Honnestly i do not care about display, i used xvfb as some posts mentionned xvfb was suitable for a server witout screen. all i want is the stdout of tool.exe
www-data home directory is /home/www-data (some .wine directory got created by wine there)
here is the php code sample i am using
Code: Select all
<?php
function executeCmd($cmd) {
$output = array();
$return_var = 0;
exec( $cmd , $output , $return_var );
if ($return_var != 0) {
$msg = "Error: " . $output[0];
error_log($msg);
die($msg);
}
$res = @implode("\n", $output);
return $res;
}
echo '<pre>';
$serial = @$_GET['serial'];
$mac = @$_GET['mac'];
$cmd = "export DISPLAY=':1' ; /usr/bin/time -p wine /var/www/tool.exe $serial $mac 2>&1";
var_dump( $cmd );
$start = microtime(true);
$response = executeCmd($cmd);
$end = microtime(true);
$time = $end - $start;
var_dump("$response");
var_dump("TIME=$time");
?>
Code: Select all
Xvfb :1 >>/var/log/xvfb.log 2>&1 &
a typical response is
Code: Select all
string(103) "export DISPLAY=':1' ; /usr/bin/time -p wine /var/www/tool.exe K252045594 AAEE5D688BC1 2>&1"
string(20) "TIME=5.2689480781555"
string(172) "
Key generator v2.53
S/N=K252045594
MAC=AAEE5D688BC1
key=58482622ZESFD
real 0.52
user 0.00
sys 0.00"
What i do not understand is that the line exec($cmd) takes about 5 seconds VERSUS if i use the same command line from bash, i get a response in a typical 0.5seconds
besides, the output seems to say more or less the same, it seems some resources taken by wine take some time to close. I do not know, i am new to wine.
What am i doing wrong ?
How do i configure wine to get with php the typical 0.5sec response time instead of the observed 5 seconds ?
any hint is appreciated
fourchu
ps : i tried to wineconsole instead of wine but i get error message : "fixme:event:wait_for_withdrawn_state window 0x10056/200001 wait timed out"