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

Questions about Wine on Linux
Locked
teleppo
Newbie
Newbie
Posts: 4
Joined: Fri Jun 16, 2017 9:31 am

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

Post by teleppo »

I installed wine on Debian 8 64 bit. I logged as user `tom` to SSH and I can windows console applications just fine from this location:

Code: Select all

/home/tom/domains/mydomain.com/public_html/
However then I made a PHP script put in on domain owned by `tom`:

Code: Select all

mydomain.com/script.php
and visites the page in a browser. And wine doesn't work from PHP. It just shows this:

Code: Select all

wine: chdir to /.wine
 : No such file or directory
The PHP code is just:

Code: Select all

exec('wine application.exe');
I am running Apache webserver. I am not sure which user is the Apache running as. When I put a PHP script on domain owned by `tom` and put there code:

Code: Select all

file_put_contents('test.txt', 'Hello');
it creates test.txt in:

Code: Select all

/home/tom/domains/mydomain.com/public_html/
and this new file is owned by `tom`. So I guess Apache is running PHP scripts as the user who owns the domain.

I tried running wine from PHP with full paths, like this:

Code: Select all

/usr/bin/wine /home/tom/domains/mydomain.com/public_html/application.exe
but this gives exactly same error:

Code: Select all

wine: chdir to /.wine
 : No such file or directory
There is .wine directory under:

Code: Select all

/home/tom/domains/mydomain.com/public_html/
So I guess that Apache is not really running scripts as `tom` but instead some other user and .wine directory must be placed in home directory of this other user. But which user should it be?
User avatar
dimesio
Moderator
Moderator
Posts: 13205
Joined: Tue Mar 25, 2008 10:30 pm

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

Post by dimesio »

teleppo wrote: So I guess that Apache is not really running scripts as `tom` but instead some other user and .wine directory must be placed in home directory of this other user. But which user should it be?
That's not really a Wine question; it's an Apache question. Some ways to find out the answer: https://serverfault.com/questions/12586 ... running-as.
teleppo
Newbie
Newbie
Posts: 4
Joined: Fri Jun 16, 2017 9:31 am

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

Post by teleppo »

Wine says:

Code: Select all

wine: chdir to /.wine
 : No such file or directory
can I force it to give me absolute path instead of relative?
teleppo
Newbie
Newbie
Posts: 4
Joined: Fri Jun 16, 2017 9:31 am

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

Post by teleppo »

Finally I found out Apache's user is 'apache' but due to some permission issues I can't put .wine directory in home directory of this user. So how can I give Wine a different location to it's .wine directory?
teleppo
Newbie
Newbie
Posts: 4
Joined: Fri Jun 16, 2017 9:31 am

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

Post by teleppo »

Thank you. I did this and works just fine:
exec('env WINEPREFIX=/home/tom/.wine wine application.exe');
Locked