You are here: PHP and COM+ prob « PHP « IT news, forums, messages
PHP and COM+ prob

Posted by Bob Pilly on 05/17/05 11:31

Hi all!

I am trying to start word using com and php and having
problems. I am running php 5.04 and apache 2.054 on
windows. I have used a simple example from the php
site but cant get it working.

|<?php
// starting word
$word = new COM("word.application") or die("Unable to
instantiate Word");
echo "Loaded Word, version {$word->Version}\n";

//bring it to front
$word->Visible = 1;

//open an empty document
$word->Documents->Add();

//do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");

//closing word
$word->Quit();

//free the object
$word = null;
?>

i have called this page testcom.php but when i try and
view it with a clients browser i get this error:

[client xxx.xxx.xxx.xxx] PHP Fatal error: Uncaught
exception 'com_exception' with message 'Failed to
create COM object `Word.application': Invalid
syntax\r\n' in C:\\Program Files\\Apache
Group\\Apache2\\htdocs\\testcom.php:3\nStack
trace:\n#0 C:\\Program Files\\Apache
Group\\Apache2\\htdocs\\testcom.php(3):
com->com('Word.applicatio...')\n#1 {main}\n thrown in
C:\\Program Files\\Apache
Group\\Apache2\\htdocs\\testcom.php on line 3

|
Has anyone seen this error before or know what it
means? Or if possible does anyone know of any good
docs on using com with php?

Thanks in advance for any help!!

Cheers

Bob





___________________________________________________________
Yahoo! Messenger - want a free and easy way to contact your friends online? http://uk.messenger.yahoo.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация