Jump to content

HOW do I run a Windows program from the browser?


dkperez

Recommended Posts

I want to display images.  LOCAL IMAGES.  We can argue about all the reasons to "download the files from the server" and all the other extraneous stuff, but right now I need to know HOW to do this...

 

In php I figure out what files should be in the show and create a file with the list.  Irfanview has a command line option so it'll start up and display the local files.  It looks like:

 

c:\xampp\htdocs\i_view32.exe /slideshow=xxx.txt

 

Open a Windows command window, put in the text, and it works PERFECTLY......

 

HOW do I do this from php?  I found the "EXEC" command, and tried:

 

$status=exec ("c:\xampp\htdocs\i_view32.exe /slideshow=xxx.txt");

 

and I get activity, but no Irfanview popping up and running...

 

What DO I need to do to get this to work?

Link to comment
Share on other sites

It may be that you are not escaping the slashes.

 

$status=exec ("c:\\xampp\\htdocs\\i_view32.exe /slideshow=xxx.txt");

 

Give that a try and see if it yields some results. Just a note, this will only work on your server, if the server is on your local machine and that is what you want, it should work properly.

Link to comment
Share on other sites

Tried the line, which is one I've tried before.  I get the "loading" message and spinning indicator, but nothing ever comes up......  It doesn't get much simpler than this example, so what's going on?

 

<?php

$status=exec ("c:\\xampp\\htdocs\\i_view32.exe /slideshow=xxx.txt");

?>

 

Link to comment
Share on other sites

Without knowing what i_view32.exe does and what the expected results should be, best guess is that you need to go into the Apache service under the Windows service control panel and check the "Allow service to interact with desktop" checkbox and restart the Apache service.

Link to comment
Share on other sites

Let me switch to a (hopefully) more generic example:

 

<?php

$status=exec ("notepad.exe");

?>

 

which I PRESUME should just run notepad.... 

 

Unfortunately, you lost me with the "go into the Apache service under the Windows service control panel and check the "Allow service to interact with desktop" checkbox and restart the Apache service."

 

I'm running xampp, so I'll have to figure out how to get into the Windows service control panel and all that....

 

Link to comment
Share on other sites

OK, found the thing in services to tell Apache to interact with the desktop.......

 

Shut everything down and restarted.......  When I run the php, instead of getting a notepad window I just get "loading" and nothing happens.......

 

What am I missing?

Link to comment
Share on other sites

Can you elaborate on that?  Isn't "my computer" the client?  It's a single laptop that'll have the software running locally...  So, again, still have the same problem....  Even WITH the full path I can't get Notepad or Irfanview or

anything else to come up and run normally.

Link to comment
Share on other sites

The client is a computer that connects to your server to view pages on it. When your laptop is the only computer used to watch pages served by your laptop, then yes, your laptop is both a client and the server.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.