Reply to Re: [PHP] php5 COM strange behaviour

Your name:

Reply:


Posted by Jochem Maas on 08/23/05 17:11

Martin Staiger wrote:
> Hello NG,
>
> we have a script to create a word-document via COM which, so far, run pretty
> stable under php 4.3.7

are you using apache2 with php4?
are you using the prefork version of apache2? (you should be!!)

>
> Since we upgraded to php 5.0.3.3 the same script works only on the first

maybe try 5.0.2, 5.0.4 or 5.0.5beta ??

> run!

blooming odd - sounds like a thread[ing] related issue (which is why I say you should be
using the orefork version of apache2)

> On the following runs the same script causes a fatal error on the code
> below:
>
> Fatal error: Uncaught exception 'com_exception' with message 'Source:
> Microsoft Word
> Description: Wrong Parameter.' in [Scriptname]:65
> Stack trace:
> #0 [Scriptname](65): variant->GoTo('wdGoToField', 'wdGoToFirst', 1)
> #1 [SourceScript] include('[Scriptname]')
> #2 {main} thrown in [Scriptname] on line 65

apparently the COM extension is designed to throw exceptions
in php5 (sometimes). which, regardless of the fact that this exception
is being thrown seems to be a complete error, would seem to mean that
you are going to have to change your code slightly to incorporate
at least one try/catch block around all your code in order
to avoid uncaught exceptions.

>
> Code :
> ================================================
> $NumberFields = $word->ActiveDocument->MailMerge->fields->Count;
> for ($CounterFields = 1; $CounterFields <= $NumberFields; $CounterFields++)
> {
> $word->Selection->Range->GoTo(wdGoToField, wdGoToFirst, $CounterFields);

are wdGoToField and wdGoToFirst actually constants?

> <-- Creates Fatal Error
> ...
> }
> ================================================
>
> When we reset the Apache-Service, the script runs again once! Subsequent
> calls create the same fatal error again ... we changed access-rights in
> dcomcnfg which didn't show any influence ...
>
> Environment: win 2003 server, Apache 2.0.53
>
> I'm greatful for any hint !
>

[Back to original 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

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