douweiluo0600 2016-11-01 00:31
浏览 132
已采纳

与php shell_exec一起使用“wine”

I am currently trying to use a "wine" command from my PHP-Script.

If i execute this:

$shell = shell_exec("/usr/bin/wine --version");

All is working fine and WINE version is displayed in $shell.

But, if i try to make it like this:

$run = shell_exec("/usr/bin/wine ".$workdir."/bin/tool.exe -m ".$workdir."/bin/std.maps -a ".$workdir."/bin/alias.file -n ".$workdir."/files/".$project_name."/upload/dump.bin -o ".$workdir."/files/".$project_name."/maps/definitions.list");

Which results in:

$run = shell_exec("/usr/bin/wine /var/www/html/bin/tool.exe -m /var/www/html/bin/std.maps -a /var/www/html/bin/alias.file -n /var/www/html/files/1-59374-94700/upload/dump.bin -o /var/www/html/files/1-59374-94700/maps/definitions.list 2>&1");

I get the following output:

wine: chdir to /.wine : No such file or directory

What i am doing wrong? If i enter the command above directly to the shell, all is working fine. If i do it without /usr/bin/ in front of wine, the output's are the same.

Br, Chris

  • 写回答

1条回答 默认 最新

  • douhao2026 2016-11-01 00:48
    关注

    I haven't try it myself but I think it is because wine is run as different user with different environment settings. Try create .wine directory inside /var/www and make www-data user as owner of this directory and make /var/www/.wine HOME directory.

    $run = shell_exec("HOME=/var/www/.wine /usr/bin/wine ".$workdir."/bin/tool.exe -m ".$workdir."/bin/std.maps -a ".$workdir."/bin/alias.file -n ".$workdir."/files/".$project_name."/upload/dump.bin -o ".$workdir."/files/".$project_name."/maps/definitions.list");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?