473,816 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

exec() launched from Linux for Win commands

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:\\P rograms\\WINEDI T.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
3 3257
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
"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
*** 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
10922
by: Falk Schneider | last post by:
I wrote a PHP shell script under Linux which puts all existing PS-Files within a directory into a list and should then start a single Ghostview window for each file. Sounds simple, but it's not: The following code provides for about half of the functionality I wanted: ==============code starts $bla = array(); foreach ($filelist as $file)
17
2412
by: Piotr Wolski | last post by:
can anyone help me: using exec() function in PHP i can execute linux programms like ls,who and other, however i can not execute C programms and i really don't know why. Please help me, Peter
2
5296
by: Greg Chapman | last post by:
I am at my wit's end trying to get information out of Streamline.net's support dept about my problem. They reply quickly enough, but seem to try and give out the least possible amount of info each time. The transcript so far is reproduced for your amusement below. To summarise: I've put up a Sudoku-solving program called Sudoku.exe. I want to call it in a php script to solve a puzzle and output the solution. It works fine with...
1
5083
by: Hal Vaughan | last post by:
I've been using Runtime.exec() like this: Runtime rt = Runtime.getRuntime(); try {Process p = rt.exec("MyCommand.bat");} catch (Exception e) {do stuff} When I start my Java classes, I start them with a batch file that changes to my apps home directory. I've tried exec() with a full pathname (which seems to have problems on Windows if it has spaces in it, but I'm not sure if that's really the problem), with just the simple short batch...
5
40503
by: JW | last post by:
Hi, I don't seem to get any results from the following use of Runtime.getRuntime().exec(cmd) using Java 1.4 on Redhat linux. Suppose that in the same directory as my java file below, I have files junk1, junk2, junk3, and i want to have the java program delete all of these files.
2
1868
by: blah | last post by:
i m using Windows XP, and by tomorrow i will have have fedora core installed too. the problem is, when i use these "fork() and exec()" my windows doesnt do anything, python gives an error about the module, the kind of error when u know u r wrong. is it because these commands work on linux? if so, is it better for me to stick with fedora for my python programs or use windows? --
13
4643
by: inetquestion | last post by:
I've narrowed the code to a problem with php/iplanet on linux. When I run the following code from the command line "$status" comes back as "0" as it should. However when I hit it with a browser, status is "-1". Im guessing it has something to do with the way iplanet is invoking php, or how php was compiled. Oddly enough I have the same setup running on windows with php 4&5 and it always returns "0". Lucky for me I suppose... Anyone know...
9
2749
by: melmack3 | last post by:
Hi I have a big problem with shell commands execution via PHP. I have written a very short PHP script ilustrating the problem: <?php for($i=0;$i<1000;$i++) { exec("test.bat");
8
6616
by: r0g | last post by:
Hi There, I'm trying to migrate a locally hosted page from windows to a private Ubuntu development server and one of the key bits of functionality (which used to work fine in Windows) was the ability for the page to start a file browser via PHP's exec() function. I can't get this working under Ubuntu though e.g. <?php exec('nautilus /var/www'); ?>
0
9613
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10673
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10432
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10147
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9227
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7689
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5712
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3033
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.