Reply to Re: [PHP] php5 COM strange behaviour

Your name:

Reply:


Posted by "Martin Staiger" on 08/23/05 18:41

>> 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?

Yes !

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

No - not to my knowledge.
I couldn't really find out HOW to implement this prefork version !?!?
It's off-topic here, but could you give me a hint, what to do/where to
lookup? Is it just configuration or do we have to compile it ourselves?

>> 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 ??

I'll try Apache 2 prefork first, since the changelog of PHP doesn't indicate
any progress related to COM-operations recently.

>> 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.

We'll do so, after the core-problem is identified.

>> 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?

yep. And they work usually.

>> <-- 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

Thank you for the support !

[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

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