如何从 Apache/Php 使用 Wine?- '/var/www' 不属于你 [英] How to use Wine from Apache/Php? - '/var/www' is not owned by you
问题描述
我需要从 Debian 服务器上的 php 脚本运行 Windows 命令行工具.为此,我正在尝试 Wine.通过终端调用 wine 和该工具工作正常:$ wine tool.exe"
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"
但是当从我的 php 脚本运行相同的...
But when running the same from my php script...
exec("wine tool.exe");
exec("wine tool.exe");
...我在我的 Apache 错误日志中得到以下信息:wine: '/var/www' 不属于你,拒绝在那里创建配置目录
...I get the following in my Apache error log: wine: '/var/www' is not owned by you, refusing to create a configuration directory there
我猜这是一个简单的基本 linux 用户权限问题...我应该将 Wine 的用户权限更改为 www-data 吗?怎么样?
I guess this is a simple fundamental linux user rights problem... Should I change the user rights for Wine to www-data? How?
推荐答案
您应该创建一个单独的主目录来运行 Wine.创建一个属于www-data的目录,设置HOME变量,su www-data,运行winecfg一次;然后运行 tool.exe(作为该用户).在 exec 调用中,确保设置了 HOME(尝试 exec("HOME=/tmp/wine wine tool.exe")
)
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")
)
这篇关于如何从 Apache/Php 使用 Wine?- '/var/www' 不属于你的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!