By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,966 Members | 2,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,966 IT Pros & Developers. It's quick & easy.

exec() launched from Linux for Win commands

P: n/a
Hi everybody, this is my environment : Apache is installed on a Linux server
(RedHat9A) and
I launch the browser on a PC running WindowsXP to execute php scripts on the
Linux server.
I would run Win executables from this Linux-based Apache server.

Actually if I use exec() command running Linux commands, something like :

$command="mv /store1/www/file1.txt /store1/www/file2.txt";
exec($command, $ar_output, $res_command);
echo "res_command=".$res_command;

it returns : res_command=0 and all works fine.

The problem arises when I try to use the same exec command for running
applications in the PC, e.g.:

$command="C:\\Programs\\WINEDIT.EXE";
exec($command, $ar_output, $res_command);
echo "res_command=".$res_command;

Now it returns : res_command=127 and it does not work ( = it does not start
WINEDIT.EXE)

What is missing or wrong in my job?

Any suggestion or hint will be very useful, thanks in advance for your help.
Regards,
Paolo


Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
p.*****************************@quantel.it idiotically stated:
Now it returns : res_command=127 and it does not work ( = it does
not start WINEDIT.EXE)

What is missing or wrong in my job?

Any suggestion or hint will be very useful, thanks in advance for
your help. Regards,
Paolo


PHP is server side, it can't do anything at all on the (client) PC. If it
could it would be the biggest security hole ever made.

So what this basically means is that you're trying to run a windows command
on a linux box, which obviously isn't going to work.

--
brian ... brian@cc
www.brianculler.com
Jul 17 '05 #2

P: n/a
"Paolo Scolamacchia" <p.*****************************@quantel.it>
schrieb:
Hi everybody, this is my environment : Apache is installed on a Linux server
(RedHat9A) and
I launch the browser on a PC running WindowsXP to execute php scripts on the
Linux server.
I would run Win executables from this Linux-based Apache server.
So you have to download the Windows executable from your server and
start it manually after that.
Actually if I use exec() command [...]


exec() will always try to execute the given program on the server. You
can't start a program on the client with a PHP script running on the
server.

Regards,
Matthias
Jul 17 '05 #3

P: n/a
*** Paolo Scolamacchia wrote/escribió (Thu, 20 Nov 2003 18:20:19 +0100):
What is missing or wrong in my job?


Windows binaries do not run under Linux, the same as MacOS programs can't
be run in Windows. Do you think people would stick to Windows so massively
if they could easily run Adobe Photoshop or Tomb Raider in any OS? ;-)

--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.