Re: PHP-memory leak with COM-objects?
| From: | Gustav Wiberg | Date: | Wed, 10 Oct 2007 20:25:44 +0000 |
| Subject: | Re: PHP-memory leak with COM-objects? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-28547@lists.php.net to get a copy of this message | ||
Hi again!
I noticed I didn't pay enough attention to your question... Sorry for that.
The file is stored on the server!
And with COM-objects I managed to do a PHP-script - create a (Word)-COM-object to open a certain file (say c:\test.doc on the server). I changed te c:\test.doc from within the php-application and pushed Saved (in the Word-object that open up). And Yes, the content changed in the file c:\test.doc which is on the server.
TinyMCE or whatsoever is out of question. It must be word. I don't want to change a whole organisations policy about using word... :-)
Best regards
/Gustav Wiberg
----- Original Message ----- From: "John Mertic" <jmertic@gmail.com>
To: "Gustav Wiberg" <gustav@hmn.se>
Cc: "PHP-Windows Group" <php-windows@lists.php.net>
Sent: Wednesday, October 10, 2007 10:07 PM
Subject: Re: [PHP-WIN] PHP-memory leak with COM-objects?
Using PHP ( whether via COM or not ) in a web application to interact with a file on the local user's machine isn't possible. PHP is a server-side language in this context, and it interacts with the COM object on the server which has no access to the user's local machine. If the file is on the server, you can't push changes to it from the Word editing control in IE, it will only allow saving changes to the local computer. If you are looking at doing the first option, then a PHP web app is out of the question; perhaps a short VBScript to do any preprocessing of the document would be in order. If you are looking at the second, you may want to consider one of the Rich Text Editing tools that you can drop in a webpage, such as FCKEditor or TinyMCE; these typically will want input and output in XHTML however. John On 10/10/07, Gustav Wiberg <gustav@hmn.se> wrote:Hi! It was just an example, but say Yes. Does it make a difference? Best regards /Gustav Wiberg ----- Original Message ----- From: "John Mertic" <jmertic@gmail.com> To: "Gustav Wiberg" <gustav@hmn.se> Cc: "PHP-Windows Group" <php-windows@lists.php.net> Sent: Wednesday, October 10, 2007 7:55 PM Subject: Re: [PHP-WIN] PHP-memory leak with COM-objects?Is c:\test.doc a file on the local user's machine or the server? On 10/10/07, Gustav Wiberg <gustav@hmn.se> wrote:-- John Mertic jmertic@gmail.com http://jmertic.wordpress.com "Explaining a joke is like dissecting a frog: you understand it better, but the frog dies in the process." --Mark Twain -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpI've worked a lot with the Word COM and while it works well on a single desktop, I wouldn't recommend it for a server process. It's rather slow and while the memory eventually gets cleaned up, it still takes up a lot of memory for as little as it does. I'm not so sure OpenOffice is much better in this regard. You could push these tasks to another server, but I'd also look at what you are doing and see if you can do it another way. We currently use Word documents as template for a mail merge type operation and are looking to move these to RTF since that enables us to take Word out of the loop when doing the mail merge ( we actually just do a global find and replace in the document since we've found more consistent results with that ). But again, this all depends upon the application. John On 10/10/07, Gustav Wiberg <gustav@hmn.se> wrote:Hi again! I want the logged-in user to able to open a word-file (or an Excel-file or whatever) and then Push Save-Icon and make sure that changes are actually made. Example: John opens up file c:\test.doc. He writes "Ugly cow" in it and pushes the save-icon. Ugly Cow is now stored in file c:\test.doc. Working with COM-objects is the only solution I have found!? Normally If John opens up c:\test.doc Internet Explorer (or whatever browser) saves the file temporarily in some temp-folder (don't know exact location), lets say c:\temp\sdifiuweoriu2734872.tmp. When John pushes Save-icon he saves the new information TO the temporarily stored file IF he doesn't use Save AS... Please come with suggestions :-) Best regards /Gustav Wiberg ----- Original Message ----- From: "John Mertic" <jmertic@gmail.com> To: "Gustav Wiberg" <gustav@hmn.se> Cc: "PHP-Windows Group" <php-windows@lists.php.net> Sent: Wednesday, October 10, 2007 1:30 PM Subject: Re: [PHP-WIN] PHP-memory leak with COM-objects?-- John Mertic jmertic@gmail.com http://jmertic.wordpress.com "Explaining a joke is like dissecting a frog: you understand it better, but the frog dies in the process." --Mark Twain -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpHi! I want to use COM+ objects (especially with Word). I have understood (a lot of reading on the Internet) that when initiating COM-objects with Word (even if the object is released in variable in the code). Word leaks a lot of memory. I have also read that if I want to use Word-COM+ object I should have a dedicated server because it takes so much memory. I have tested some and I easily get out of memory even if there is 4GB on the server I tested against. Then I run PHP as ISAPI, and the suggestion on the php.net site was to run PHP as CGI because COM-objects are run in the same memory-space as ISAPI when running as ISAPI-module. http://php.oregonstate.edu/manual/en/class.com.php What do you guys thinks about above? Give me some feedback, please :-) Best regards /Gustav Wiberg No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 269.14.6/1060 - Release Date: 2007-10-09 16:43 -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- John Mertic jmertic@gmail.com http://jmertic.wordpress.com "Explaining a joke is like dissecting a frog: you understand it better, but the frog dies in the process." --Mark Twain -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php