2

I have this script that works correctly (if run via terminal manually)

#!/bin/sh
unset DISPLAY
scriptname=$1
[ -f "$scriptname" ] && scriptname=$(winepath -w "$scriptname")
wine "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" "$scriptname" "/q"

Ubuntu Server with Apache, PHP
Wine installed with Inno Setup 5 in folder Program Files (x86)
ISS File: "/home/www/files/iss/Example.iss"
Script SH: "/home/www/iscc.sh"

1a - If I access the terminal via SSH and run the file "iscc.sh" passing the file location. "Iss" as a parameter, the build is done correctly without problems.
2a - If I run all the commands in a single line (inline), the compilation is also done correctly without problems.

1b - "/home/www/iscc.sh" "/home/www/files/iss/Example.iss"
2b - unset DISPLAY && scriptname="/home/www/files/iss/Example.iss" && [ -f "$scriptname" ] && scriptname=$(winepath -w "$scriptname") && wine "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" "$scriptname" "/q"

But the problem is the following, via PHP, if I use the command shell_exec or exec or system, none of them run properly.

What can be causing these failures, can someone help me with this problem? I do not understand why not compile.

Cœur
  • 37,241
  • 25
  • 195
  • 267
D3F4ULT
  • 926
  • 1
  • 12
  • 20
  • Define "not run properly". What happens, do you get an error or what? Have you tried capturing and looking at the console output? – Miral Jul 01 '13 at 20:36
  • In any case, why are you trying to run the compiler from a web server? If you're trying to inject some sort of unique per-download data, there are much much better ways to do it. – Miral Jul 01 '13 at 20:37
  • Thanks for the reply, now fix the fault and got what I wanted, the problem was related to user and group, had to add the root user to the group www-data, and used the command "sh" and "exec . " I generate each installer in accordance with the information provided in Form PHP, so did the web, since the operating system of the server has no graphical interface, not like the log terminal and keep typing the command line to do something I can do web more practical, although it has had this problem, it was a fault of mine, then I remembered the permissions in the group www-data. – D3F4ULT Jul 03 '13 at 14:18
  • If you have anything running as root as a result of web activity, you have a very badly configured server. And as mentioned before there are much better ways to configure an installer on a per-download basis than recompiling it. – Miral Jul 03 '13 at 20:48

0 Answers0