views:

65

answers:

2

I've been trying to automate opening and populating a Word file on network but came across an issue when trying to open the file from a mapped network drive. I can open the file from my c:\ drive and I changed the Apache settings to run as a user rather than as a local service. The script runs perfectly well in the Zend environment doing everything it should but on Apache it reads the target directory but cannot open the file using COM. (The directory is a Linux network storage device and I do have read/write access.)

try {
 com_load_typelib('Word.Application');
 $word = new COM("Word.Application") or die ("Can't start Word");
 $word->visible = 1;

 $handle = opendir('\\\\<host ip addy>\\<sharename>\\<directory>');
 echo $handle . "\n";
 while (false !== ($file = readdir($handle))) {
    echo "$file\n";
 }
 $word->Documents->Open("\\\\<host ip addy>\\<sharename>\\<directory>\\test.doc");

 $word->Documents[1]->Close();
 $word->Quit();
 $word=null;
} catch (com_exception $ce) {
    echo $ce->getMessage;
 }

I'd be grateful for any thoughts on solving the issue.

A: 

You have read/write access, but does the Apache process?

Are you getting a reproducible error message?

DaveE
A: 

I had set Apache to run as my account which failed yesterday (after restarting the server) but restarting my machine seems to have unknotted it and got everything running with the right permissions.

IainE
please, do not post answers as replies, use comments instead.
dusoft