Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

apache

wine

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 tool.exe"

But when running the same from my php script...

exec("wine tool.exe");

...I get the following in my Apache error log: wine: '/var/www' is not owned by you, refusing to create a configuration directory there

I guess this is a simple fundamental linux user rights problem... Should I change the user rights for Wine to www-data? How?

like image 421
Cambiata Avatar asked Sep 04 '09 05:09

Cambiata


2 Answers

You should create a separate home directory for running Wine. Create a directory which is owned by www-data, set the HOME variable, su www-data, and run winecfg once; then run tool.exe (as that user). In the exec call, make sure that HOME is set (try exec("HOME=/tmp/wine wine tool.exe"))

like image 158
Martin v. Löwis Avatar answered Oct 17 '22 07:10

Martin v. Löwis


You're going to want to use chown to modify the ownership of wine and tool.exe.

Be advised that this could potentially open up some security concerns.

like image 28
Mike Buckbee Avatar answered Oct 17 '22 08:10

Mike Buckbee