logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Run Windows App Under Apache
Author
mogulman52



Joined: 17 Dec 2014
Posts: 2
Location: USA, Dallas

PostPosted: Wed 17 Dec '14 23:43    Post subject: Run Windows App Under Apache Reply with quote

Newbie to Apache.

I have been using IIS 7.5 on a Win7 32-bit computer. We moved to a Win7 64-bit machine and 1 app does not work. I am thinking of trying Apache 32-bit to see if that works. The script that is causing problems calls Office Word to create a document. Here is a simplified version of script.

Code:
<?php
        if (is_dir("C:\Program Files (x86)")){
            $runWord = '"C:\Program Files (x86)\Microsoft Office\Office14\Winword.exe C:\userdata\tripq\trip-web\test.dotm"';
        } else {
            $runWord = '"C:\Program Files\Microsoft Office\Office14\Winword.exe" "C:\userdata\tripq\trip-web\test.dotm"';
        }
        $WshShell1 = new COM("WScript.Shell");
        $oExec1 = $WshShell1->Run($runWord, 7, true);
        $oExec1 = null;
?>


On IIS you have AppPools and you can set an AppPool to run under a user account. I also set the AppPool to run 32-bit apps. Still doesn't work on Win7 64-bit. In Apache I need to something similar. I saw a posting about 'Allow service to interact with desktop'.

What is the recommended way to do this?[/code]
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Thu 18 Dec '14 12:10    Post subject: Reply with quote

Hi,

a sample code from PHP.net

Code:

<?php
$word = new COM("word.application") or die ("Could not initialise MS Word object.");
$word->Documents->Open(realpath("Sample.doc"));

// Extract content.
$content = (string) $word->ActiveDocument->Content;

echo $content;

$word->ActiveDocument->Close(false);

$word->Quit();
$word = null;
unset($word);
Back to top
mogulman52



Joined: 17 Dec 2014
Posts: 2
Location: USA, Dallas

PostPosted: Thu 18 Dec '14 23:59    Post subject: Reply with quote

Actually got it working. It was fairly easy. Installed XAMPP. Set it to install as service. Then setup user account that can run Word. Then set service to run under user account. I can now automatically create Word docs and PDFs on server and pass links back to user. I spent a good 2 weeks trying to get this working on Win7/64-bit IIS. I set IIS to run 32-bit apps but it would not run. It works on Win7/32-bit IIS.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Sat 20 Dec '14 23:13    Post subject: Reply with quote

Do you still use that script you posted above? Just curious Wink
Back to top


Reply to topic   Topic: Run Windows App Under Apache View previous topic :: View next topic
Post new topic   Forum Index -> Apache