How to use Wine from Apache/Php? - '/var/www' is not owned by you

后端 未结 7 1304
被撕碎了的回忆
被撕碎了的回忆 2020-12-18 06:55

I need to run a windows command line tool from a php script on my Debian server. For that, I\'m trying Wine. Invoking wine and the tool via terminal works fine: \"$ wine too

7条回答
  •  感情败类
    2020-12-18 07:21

    Since I'm running FreeBSD I get the error wine: '/root' is not owned by you. Creating a folder called '/var/www' won't be of much help :(

    Apache is running as www, or the threads are, while the main process starts as root as far as I know. If you don't have any admin rights, you can always try to ask the admin to add a line in the sudoers file.

    I've added the following line to my sudoers file and it let's Apache (the www user) use sudo to run wine as my user (myuser), instead of as www or root.

    www localhost = (myuser) NOPASSWD: /usr/home/myuser/bin/wine

    In my PHP script I have something like this:

    exec("HOME=/usr/home/myuser sudo -u myuser /usr/home/myuser/bin/wine /usr/home/myuser/test.exe"

    Seems to work so far.

提交回复
热议问题