Webserver permissions

Hello.

I've been looking for this for a long time. I'm newbie at linux, so I try to say everything I did.

I have setup Xvfb, and with root account I have run:

Xvfb :1 &

So that I have a X server for using wine.

I have setup wine and I want to run a command that looks like this:

in shell (with putty)

DISPLAY=:1 wine c:\\program.exe -file test.ext

and all works fine.

All I need is to run this command with php. I started testing this in php script like:

This gives me a blank screen, no output, no error.

even shell_exec('DISPLAY=:1 wine c:\program.exe -file test.ext'); (exact same line as shell) shows no output.

However this:

shellexec('DISPLAY=:1 wine /root/.wine/drivec/program.exe -file test.ext');

Will successfully run the program.exe and in the output, program.exe is telling me that it can't create its temp file, so the whole process fails.

I don't know what kind of a permission is this that I can run wine successfully and wine can run the program.exe, but the program.exe can't create its needed file or lets says access to other files on the system for its needs. (Note that the whole thing perfectly works if I run the command directly in shell)

I have tried:

chmod 777 -R .wine

or

chown www-data .wine -R

no success.

Someone told me it is Apparmor that overrides directory permissions. But before disabling or doing anything to that, I decided to start this topic to do what is best.

Please help!

Thanks for your time.

Just a side note, maybe to help:

Shell_exec('env'); in php and 'env' directly in shell gives me same variables but these:

PWD in shell is /root, with php is the document root of my site.

HOME in shell is /root, with php is /var/www

PATH in shell is /usr/lib/kde4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin but in php it is /sbin:/usr/sbin:/bin:/usr/bin

Another vairable in shell is:

_=/usr/bin/env

in php:

_=/etc/init.d/php-fastcgi

(USERNAME in php is root too)

I tried to set them to what it is with shell by putenv() function in php, but still no success.

I have:

Ubunto 8.04

Wine 1.1.37

Nginx as webserver

PHP5

0 Replies

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct