I'm not even sure that this is the correct forum to post this question, so please feel free to redirect me if it isn't.

I've been tasked with something that seems just short of impossible (for me) to do. Bottom line: I have to allow anybody with a browser to get onto our website and, with a click of the mouse, run a specific program or batch file. The problem is that our website is hosted on Ubuntu (a LAMP server) and the program is a Windows executable, located on a Windows server, both of which are in our facility.

I can easily share files between the two servers, but if I attempt to use, say, PHP to call the program, it simply can't, of course, because the PHP is running on the Ubuntu server and attempting to run a Windows program. Thoughts?

Thanks,
Tredspane

Recommended Answers

All 3 Replies

Couple of ideas off the top of my head.

Usually RPC (remote procedure call) could be used to remote execute code on another host. Obviously that won't work here.

Maybe using something like the PSExec http://technet.microsoft.com/en-us/sysinternals/bb897553 in a WINE instance on the linux host might work. But I've never tried it.

Why not run IIS on the windows host and use the same code on that win server instead to call the file? Use a forward on the Linux host over to the win host for that 'link'.

On the linux host, when the link is clicked, have it write out a temp file on the windows host. The windows host could run a scheduled task every minute to check for the existance of a temp file and run jobs based on it's existance/contents.

Thanks for taking the time to respond. I'll give one or more of these a try and get back with you...I might need to do some coordinating with our IT folks, and that might take a few days.

Nothing you recommended worked for me. It would take too long to go through all the error situations, and the permutations of workarounds, etc., that I have tried with your approaches. (For example, WINE is a heavy app that presents an unacceptable performance hit. IIS is not permitted by Sox to be installed on our host. Windows Task cannot run every minute, as you suggested; even every five seconds is too long.)

But I found a (kinda lame) way to do what I needed, so I'll share it here:

When a user clicks on a specific link, the PHP page creates a PHP mail() message and sends it to my email address with a specific subject line. On my client I created a rule in Outlook to handle every email message with this subject line, telling it to delete the message and run the Windows app.

The problem with this approach is that, because (and only because) I'm asking the rule to run an app, that forces the rule to execute client-side (opposed to server-side), which forces my workstation to remain up and running 24/7. That's not really a problem, since I already keep my station running 24/7.

Somewhat lame, but works, and nothing else I could find does.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.