Hi, I'm trying to run a command with wine via php: Code: <?php $test = shell_exec('wine c:\\\\.exe'); echo $test; ?> [/code]
Please delete my first post. I'm trying to run a command with wine via php: Code: <?php $test = shell_exec('wine c:\\\\program.exe'); echo $test; ?> It doesn't work. but the same command : wine c:\\program.exe Works fine in the SSH directly. I tried with php shell_exec('wine --version') and I received my wine version but can't run the program through my browser (php). any idea? Ubuntu: 8.04 Wine: 1.1.37 webserver: nginx php: 5
Thanks for the replay. I compared them: 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 Should I change these for php and how? and how to set them b ack after I ran the program?
I changed all the env variables and test them, they were all changed. but still no success. I found this: http://stackoverflow.com/questions/1377388/how-to-use-wine-from-apache-php-var-www-is-not-owned-by-you What is it? (I created /var/www/.wine and 'chown www-data /var/www/.wine'. no success still)
asmith wrote:> I'm trying to run a command with wine via php: It doesn't work. but the same command : wine c:\\program.exe Works fine in the SSH directly.To run most (all) programs Wine needs X display. If you running this on the server you'll need to setup a virtual X server and point Wine to it (DISPLAY env var).
asmith wrote:> I ran that program in shell: wine program2.exe, and I received the text.You ran that as what user? asmith wrote:> Again I tested the same line in php, a blank screen. no output, no error.In most systems apache and php running under highly restricted user with big memory restrictions. Also Wine needs to setup it's prefix on first run. asmith wrote:> in mean time I DO get output for: 'wine --version', or 'ls -al'Well yeah, wine --version doesn't get any further then wine launcher itself which has version hardcoded during compile time. Enable php logging in /etc/php.ini into a file. Make sure it's in place where user running apache can write into. See syslogs for apache itself.
I'm sorry I'm newbie on linux and wine, but I'm trying my best. I did: mv /root/.wine /home/username/.wine and env WINEPREFIX=?/home/username/.wine? But wine didn't changed its prefix. by wine program.exe wine again created .wine in root. (I am logged as root for now) How do I change it?
I created another profile for wine in /home/username/.wine/ But my php still uses the root username to access, so it uses wine profile for root. I think I narrowed down the problem. I have permission issues. Wine can run the program itself. but when program.exe wants to start its processing, it fails creating its own temp files or accessing some files it needs on the system. When running it directly in shell, it has full access to any file, that's why it works fine. But with php it doesn't. chowning wine profile doesn't seem to work. How can I move my .wine to another folder? I dont' wanna create another one. Just move this working one to my public_html folder, so that maybe it works there? or just find the option in apache (I use nginx) to give permission to this one.