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
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.