PHP question

Questions about Wine on Linux
Locked
asmith
Level 2
Level 2
Posts: 22
Joined: Sun Apr 19, 2009 5:07 am

PHP question

Post by asmith »

Hello,

I've setup wine on my Ubuntu 10.04 LTS server. The wine profile is setup here:

/home/myusername/.wine

Everything works fine. With a php script I'm trying to run wine which I've succeeded. The script looks like something like this:

Code: Select all

<?php

putenv("USER=myusername"); // no effect
putenv("HOME=/home/myusername");

exec('wine command ...');

?>
The problem is that for this to work, my php script (which is www-data user) must be the owner of wine. So if in my terminal I take the ownership:

> sudo chown -R www-data:www-data .wine

Then the script works fine. I want to know if there's a way I leave ownership of .wine folder to myusername but still could access it via www-data?
the putenv("USER=myusername"); command doesn't have any effect.

Thanks for your attention.
User avatar
DanKegel
Moderator
Moderator
Posts: 1164
Joined: Wed May 14, 2008 11:44 am

Post by DanKegel »

Wine is not meant to be shared between users.

You might be able to set up a group that both users are in,
and use group permissions to allow both users to write,
but I've never tried that, and you'll have to be careful to
avoid both users running wine at the same time.
qparis
Level 2
Level 2
Posts: 44
Joined: Fri Dec 03, 2010 6:55 am

Post by qparis »

You might want to create a separate wineprefix for your web app.

What do you want to run exactly with PHP?

Otherwise, you could try

<?php
putenv("WINEPREFIX=/var/www/wine_data"); // Just an example, be careful with permissions

exec('wine /var/www/wine_data/drive_c/some exe file');
?>

You'll have to create the prefix manually before running your php scripts otherwise, it'll be broken.
Locked