php-windows Digest 27 Apr 2002 20:52:24 -0000 Issue 1115

Topics (messages 13352 through 13361):

Re: GD solutions
        13352 by: Sebastian Müsch
        13353 by: Webmaster

Showing a blob filed part II
        13354 by: Waldemar Brand Neto
        13357 by: George Nicolae
        13358 by: George Nicolae

Re: Excel not closing after using it via COM
        13355 by: Harald Radi
        13356 by: Alan Brown

executing an external program
        13359 by: Rainer Bruch
        13361 by: Mike Flynn

possible bug or ?
        13360 by: Erik

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hi,

> 1st - GD (even in the binaries) must be compiled manually ( I have no
compiler)

Then tell me, which options to use to compile and I'll compile it for
you.

You told me, your server hangs if you use precompiled binaries ...

Maybe you try on of these solutions:

- Update MicrosoftVisualC Runtime
- Update MDAC Components
- Update Winsock

Please tell us, which way you are using PHP ...

As module, cgi etc.
On which server ... I think on Win98 you use Apache.

And last but not least, send us a script on which the server hangs.

Cu
MSepp



--- End Message ---
--- Begin Message ---
Thanks for replying, I had untagged the - extention="GD2.DLL" - which isn't
nessesairy at all.
The extention="GD.DLL"- or what it suppose to do is now standard included
(supported) by PHP.

This means the problem is solved now :0)

By the way, I am using Windows 98 with Xitami webserver, partly loaded as
CGI, but also as a normal runtime element.

Works great this way!

Thanks again,

"Sebastian müsch" <[EMAIL PROTECTED]> schreef in bericht
000601c1edd6$51b8bbd0$1b3c00d9@mseppathome">news:000601c1edd6$51b8bbd0$1b3c00d9@mseppathome...
> Hi,
>
> > 1st - GD (even in the binaries) must be compiled manually ( I have no
> compiler)
>
> Then tell me, which options to use to compile and I'll compile it for
> you.
>
> You told me, your server hangs if you use precompiled binaries ...
>
> Maybe you try on of these solutions:
>
> - Update MicrosoftVisualC Runtime
> - Update MDAC Components
> - Update Winsock
>
> Please tell us, which way you are using PHP ...
>
> As module, cgi etc.
> On which server ... I think on Win98 you use Apache.
>
> And last but not least, send us a script on which the server hangs.
>
> Cu
> MSepp
>
>
>


--- End Message ---
--- Begin Message ---
Thank you for the help. I put the header in the top ot the document and now it works. 
I need one more tip. The result is not the image itself, but the content of the Blob 
Field, how can I fix that?

Thanks.
Waldemar
 The source code:
<?php
header("Content-type: image/jpeg");
header("Content-Disposition: inline; filename=temp.jpg");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Teste.php</title>
</head>
<BODY BGCOLOR=#3366FF>
<CENTER>
<FORM>
<h1> Kompatscher & Cia Ltda </h1>
<hr>
<?php
$con = mysql_connect("**************************) or die ("Erro ao conectar!");
mysql_select_db("***********", $con) or die ("Erro ao selecionar a database!");
$comando="SELECT codigo,nome,material,temperatura,pressao,fluido,descricao,foto FROM 
cadgrupo WHERE codigo=010";
$res = mysql_query($comando,$con);
$linha = mysql_fetch_array($res);
echo "<TABLE ALIGN=CENTER>";
echo "<tr>";
echo "<td>";
echo "Foto";
echo "</td>";
echo "<td>";
$i= $linha['foto'] ;
echo "<input type=image src=$i border=0>";
echo "</td>"; 
echo "</tr>"; 
echo "</TABLE>";
mysql_close($con);
?>
</FORM>
</CENTER>
</BODY>
</html>

--- End Message ---
--- Begin Message ---
try to echo $i  in a separate file (lets say image.php) and in the main file
do
echo "<input type=image src=".image.php." border=0>";

--


Best regards,
George Nicolae
IT Manager
___________________
PaginiWeb.com  - Professional Web Design
www.PaginiWeb.com


"Waldemar Brand Neto" <[EMAIL PROTECTED]> wrote in message
005f01c1edf9$7ca7dce0$[EMAIL PROTECTED]">news:005f01c1edf9$7ca7dce0$[EMAIL PROTECTED]...
Thank you for the help. I put the header in the top ot the document and now
it works.
I need one more tip. The result is not the image itself, but the content of
the Blob Field, how can I fix that?

Thanks.
Waldemar
 The source code:
<?php
header("Content-type: image/jpeg");
header("Content-Disposition: inline; filename=temp.jpg");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Teste.php</title>
</head>
<BODY BGCOLOR=#3366FF>
<CENTER>
<FORM>
<h1> Kompatscher & Cia Ltda </h1>
<hr>
<?php
$con = mysql_connect("**************************) or die ("Erro ao
conectar!");
mysql_select_db("***********", $con) or die ("Erro ao selecionar a
database!");
$comando="SELECT
codigo,nome,material,temperatura,pressao,fluido,descricao,foto FROM cadgrupo
WHERE codigo=010";
$res = mysql_query($comando,$con);
$linha = mysql_fetch_array($res);
echo "<TABLE ALIGN=CENTER>";
echo "<tr>";
echo "<td>";
echo "Foto";
echo "</td>";
echo "<td>";
$i= $linha['foto'] ;
echo "<input type=image src=$i border=0>";
echo "</td>";
echo "</tr>";
echo "</TABLE>";
mysql_close($con);
?>
</FORM>
</CENTER>
</BODY>
</html>




--- End Message ---
--- Begin Message ---
My mistake. The correct code is:
"<input type=image src=image.php border=0>";

--


Best regards,
George Nicolae
IT Manager
___________________
PaginiWeb.com  - Professional Web Design
www.PaginiWeb.com


"George Nicolae" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> try to echo $i  in a separate file (lets say image.php) and in the main
file
> do
> echo "<input type=image src=".image.php." border=0>";
>
> --
>
>
> Best regards,
> George Nicolae
> IT Manager
> ___________________
> PaginiWeb.com  - Professional Web Design
> www.PaginiWeb.com
>
>
> "Waldemar Brand Neto" <[EMAIL PROTECTED]> wrote in message
> 005f01c1edf9$7ca7dce0$[EMAIL PROTECTED]">news:005f01c1edf9$7ca7dce0$[EMAIL PROTECTED]...
> Thank you for the help. I put the header in the top ot the document and
now
> it works.
> I need one more tip. The result is not the image itself, but the content
of
> the Blob Field, how can I fix that?
>
> Thanks.
> Waldemar
>  The source code:
> <?php
> header("Content-type: image/jpeg");
> header("Content-Disposition: inline; filename=temp.jpg");
> ?>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <html>
> <head>
> <title>Teste.php</title>
> </head>
> <BODY BGCOLOR=#3366FF>
> <CENTER>
> <FORM>
> <h1> Kompatscher & Cia Ltda </h1>
> <hr>
> <?php
> $con = mysql_connect("**************************) or die ("Erro ao
> conectar!");
> mysql_select_db("***********", $con) or die ("Erro ao selecionar a
> database!");
> $comando="SELECT
> codigo,nome,material,temperatura,pressao,fluido,descricao,foto FROM
cadgrupo
> WHERE codigo=010";
> $res = mysql_query($comando,$con);
> $linha = mysql_fetch_array($res);
> echo "<TABLE ALIGN=CENTER>";
> echo "<tr>";
> echo "<td>";
> echo "Foto";
> echo "</td>";
> echo "<td>";
> $i= $linha['foto'] ;
> echo "<input type=image src=$i border=0>";
> echo "</td>";
> echo "</tr>";
> echo "</TABLE>";
> mysql_close($con);
> ?>
> </FORM>
> </CENTER>
> </BODY>
> </html>
>
>
>
>


--- End Message ---
--- Begin Message ---
> Is temporary-object behaviour supposed to happen
> in cases like $obj->another->func(), or is this
> an unintended side-effect of something else?

no side effect, happens each time you dereference more than one member.

$obj->foo->bar->func();

will therefore create two temp objects.

>
> Does PHP usually create temp-objects when referencing
> $obj->another, or is that behaviour only part of
> the COM subsystem?

it is the case for non-native php objects. the php com subsystem is only a wrapper 
that makes a com object behave like a
regular php object.
so if you do something like

$foo->bar->func();

we first have to create a wrapper for 'bar' so that it behaves like a php object and 
we can call func() on it.
doing

$baz = $foo->bar;
$baz->func();

does not change the fact that a wrapper for 'bar' is created, but in this case the 
wrapper is not temporary but it is
assigned to '$baz'. due to a bug the temporary objects were not released but the named 
ones were released by phps
garbage collector.
this is fixed now !!

> Sorry for asking questions that are probably obvious,
> but i'm not really too familiar with the details
> of PHP's object handling.

noprob.

regards,
harald


--- End Message ---
--- Begin Message ---
There is more to know here. Even with the bug fix in place it is still
possible to leave excel in memory.

These two lines will do just that.
$excel = new COM("Excel.Application");
$book = $excel->workbooks->open($file);

If you add a $book->close(FALSE); then excel goes away proerly. Thus when
you see an "exception" and you do not have a handler which "cleans up" I
suspect you are leaving yourself open to leaving excels around. I have to
say that I have not tested this behavious with either VB or Perl so I cannot
as yet assign this to M$ wierdness.

But there is a "workaround". You do not HAVE to use "$excel = new
COM("Excel.Application")" to get at excel. You can access excel using the
moniker method (just like some of the WMI and IIS examples floating around -
and like VB GetObject())

$file = 'I:\\tmp\\test1.xls';
$obj = new COM($file); # Am not entirely sure I know what it is that is
returned here
# but this code seems to work.
$excel = $obj->Application;
$book = $excel->workbooks->open($file);
$book->close(FALSE);
$excel->quit();

The value of this form is that it will "reuse" an existing copy of EXCEL. So
e.g. if you have the problem I described above you can always access the
.xls file through the monitor (file name) and ask COM to find an existing
running instance of the server to process it in (if there isn't one I do
believe it will launch one for you). This way you only have one errant
instance and not hundreds.

Alan.

----- Original Message -----
From: "Neil Lincoln" <[EMAIL PROTECTED]>
To: "Alan Brown" <[EMAIL PROTECTED]>; "Scott Hurring" <[EMAIL PROTECTED]>;
"Php-Win (E-mail)" <[EMAIL PROTECTED]>
Sent: Friday, 26 April, 2002 17:27
Subject: RE: [PHP-WIN] Excel not closing after using it via COM


> GREAT!
>
> -----Original Message-----
> From: Alan Brown [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 26, 2002 3:24 PM
> To: Scott Hurring; Php-Win (E-mail)
> Subject: Re: [PHP-WIN] Excel not closing after using it via COM
>
> Not intended behaviour. A fix has been checked into CVS already.
>
> ----- Original Message -----
> From: "Scott Hurring" <[EMAIL PROTECTED]>
> To: "Php-Win (E-mail)" <[EMAIL PROTECTED]>
> Sent: Friday, April 26, 2002 16:08
> Subject: RE: [PHP-WIN] Excel not closing after using it via COM
>
>
> > Neil: Go through your code and make sure there are no
> > indirect object references like $obj->obj->func();
> >
> > >From what i understand, it seems that this type of
> > construction is causing a temporary object to be
> > left around (which is, in turn, causing excel to
> > remain zombie, becuase the temp-object is never
> > properly cleaned up)
> >
> > Anyone with knowledge of COM... is this intended
> > behaviour?  Do COM objects *need* a Quit() signal
> > to die, even if the program that was manipulating
> > the COM object dies (as is the case with PHP
> > finishing up and EXCEL still in memory when a
> > temp-object is not properly unset())?
> >
> > ---
> > Scott Hurring
> > Systems Programmer
> > EAC Corporation
> > [EMAIL PROTECTED]
> > Voice: 201-462-2149
> > Fax: 201-288-1515
> >
> > > -----Original Message-----
> > > From: Neil Lincoln [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, April 26, 2002 9:23 AM
> > > To: Alan Brown; Scott Hurring; Php-Win (E-mail)
> > > Subject: RE: [PHP-WIN] Excel not closing after using it via COM
> > >
> > >
> > > We have tried this and it doesn't help. And yes, any non
> > > normal exit from
> > > the EXCEL COM object results in a "zombie".
> > >
> > > -----Original Message-----
> > > From: Alan Brown [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, April 26, 2002 8:00 AM
> > > To: Scott Hurring; Php-Win (E-mail)
> > > Subject: Re: [PHP-WIN] Excel not closing after using it via COM
> > >
> > > There is a missing "Release" call in the COM code when
> > > temporary objects are
> > > created for a construct such as
> > >
> > > $excel->application->DisplayAlerts = False;
> > >
> > > This is not as visible a problem with an inproc server as
> > > with a localserver
> > > such as Excel.
> > >
> > > It is fairly easy to work around this (until I get a real fix
> > > into the base)
> > > by breaking it up thus:
> > >
> > > $application = $excel->application;
> > > $application->DisplayAlerts = False;
> > >
> > > This has to be done in two places in the example I saw.
> > > However I note that
> > > if you put in a logic error such as this:
> > > $book = $workbooks->Open($file);
> > > $sheet = $books->Worksheets(1);
> > >
> > > After the exception a copy of Excel is still left running. I
> > > wiill look more
> > > at this over the weekend and test my Release() call on the
> > > temporary object.
> > > It seems to work, but I fear that it will break something else....
> > >
> > > Alan.
> > >
> > > ----- Original Message -----
> > > From: "Scott Hurring" <[EMAIL PROTECTED]>
> > > To: "Php-Win (E-mail)" <[EMAIL PROTECTED]>
> > > Sent: Thursday, 25 April, 2002 13:51
> > > Subject: RE: [PHP-WIN] Excel not closing after using it via COM
> > >
> > >
> > > > I'm not doing this through Apache.
> > > >
> > > > I tried out Win32 command line PHP and Perl.
> > > >
> > > > So even though it might be an issue with Excel being
> > > > owned by "SYSTEM" when run thru Apache, PHP still leaves
> > > > it open whereas Perl does not.
> > > >
> > > > (And to boot, my Apache service is configured to
> > > >  RunAs my account "scott", so it shouldn't be plauged
> > > >  by the "SYSTEM" ownership issue... even though
> > > >  i haven't tested it)
> > > >
> > > > Please check out: http://furt.com/code/php/com_issues/
> > > > (Read 'readme.txt')
> > > >
> > > > ---
> > > > Scott Hurring
> > > > Systems Programmer
> > > > EAC Corporation
> > > > [EMAIL PROTECTED]
> > > > Voice: 201-462-2149
> > > > Fax: 201-288-1515
> > > >
> > > > > -----Original Message-----
> > > > > From: Neil Lincoln [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Thursday, April 25, 2002 1:20 PM
> > > > > To: Scott Hurring; Php-Win (E-mail)
> > > > > Subject: RE: [PHP-WIN] Excel not closing after using it via COM
> > > > >
> > > > >
> > > > > On our systems the EXCEL COM object executes as a member of
> > > > > "SYSTEM" instead
> > > > > of as a child of the owner of the Apache/php server. When the
> > > > > COM object
> > > > > completes it leaves the EXCEL hanging around as a child of a
> > > > > SYSTEM process.
> > > > >
> > > > > -----Original Message-----
> > > > > From: Scott Hurring [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Thursday, April 25, 2002 11:59 AM
> > > > > To: Php-Win (E-mail)
> > > > > Subject: RE: [PHP-WIN] Excel not closing after using it via COM
> > > > >
> > > > > I went back and ran some perl code using the
> > > > > Excel COM object.  Excel does properly exit...
> > > > > so it looks like you are correct -- it's
> > > > > probably a bug in PHP's COM code.
> > > > >
> > > > > Attached is is sample Perl, PHP and Excel,
> > > > > if anyone wants to verify that excel does
> > > > > indeed die after the perl script is finished,
> > > > > yet stays alive when the PHP script is
> > > > > finished.
> > > > >
> > > > > ---
> > > > > Scott Hurring
> > > > > Systems Programmer
> > > > > EAC Corporation
> > > > > [EMAIL PROTECTED]
> > > > > Voice: 201-462-2149
> > > > > Fax: 201-288-1515
> > > > >
> > > > > > -----Original Message-----
> > > > > >    Try
> > > > > >
> > > > > >     $book->Close("False");
> > > > > >
> > > > >
> > > > > Doesnt do anything.
> > > > >
> > > > > >    But then one has to ask, why does it work fine from other
> > > > > > languages, e.g. Perl? If the API were broken, it would seem
> > > > > > that it would be broken regardless of the language one was
> > > > > > using.
> > > > > >
> > > > > >      Scott
> > > > >
> > > > > Yeah.. that's the way it seems now.
> > > > >
> > > > >
> > > > > ---
> > > > > Incoming mail is certified Virus Free.
> > > > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > > > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> > > > >
> > > > > ---
> > > > > Outgoing mail is certified Virus Free.
> > > > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > > > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> > > > >
> > > > >
> > > >
> > > > --
> > > > PHP Windows Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> > >
> > >
> > > --
> > > PHP Windows Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > ---
> > > Incoming mail is certified Virus Free.
> > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> > >
> > > ---
> > > Outgoing mail is certified Virus Free.
> > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> > >
> > >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
i am new in using and understanding php. need help in following issue:
opening (executing) an external program (not a file) like "winword.exe" with
php4.
my system-configuration:
- windows 2000
- php4 1.1.1
- winword execution program-path is:
"c:\programme\micosoft office\office\winword.exe"

please, will somebody out there will help me with the complete php-code
like:
<?
"code to execute the winword-program";
?>

i have asked a so called specialist who gave the following (not functioning,
no error message) code:
<?
shell_exec("c:\programme\microsoft office\office\winword.exe");
?>

thanks to all who will help me
rainer


--- End Message ---
--- Begin Message ---
Some things to think about are:
1. http://www.php.net/manual/en/function.exec.php
2. If you are going to use backslashes in a string, you need to escape 
them, so the sample code your "specialist" gave you would need to be changed:
><?
>shell_exec('c:\\programme\\microsoft office\\office\\winword.exe');
>?>
Otherwise PHO would see \p, \m, \o, \w escape codes.

-Mike

At 06:45 PM 4/27/02 +0200, Rainer Bruch wrote:
>i am new in using and understanding php. need help in following issue:
>opening (executing) an external program (not a file) like "winword.exe" with
>php4.
>my system-configuration:
>- windows 2000
>- php4 1.1.1
>- winword execution program-path is:
>"c:\programme\micosoft office\office\winword.exe"
>
>please, will somebody out there will help me with the complete php-code
>like:
><?
>"code to execute the winword-program";
>?>
>
>i have asked a so called specialist who gave the following (not functioning,
>no error message) code:
><?
>shell_exec("c:\programme\microsoft office\office\winword.exe");
>?>
>
>thanks to all who will help me
>rainer
>
>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


-- Mike Flynn --
mike @ mikeflynn . net
home => work => home => shop => home [adbusters]

--- End Message ---
--- Begin Message ---
hi all,

To this newsserver i'm new but i use php for over two years now.Last night i
checked the offcial php website to see if ther is a newer version relased as
mine 4.1.2 so i downloaded and installed the latest php.i edited my
httpd.conf file and installed php as module restarted my apache server and
by a test i tryed to submit the form on my website apache said "http 500
internal server error" usually this is related to the files rights read
write etc CHMOD but i'm on windows 2000 so there is no CHMOD what is wrong
here why do i get that error ? the same form worked fine with the php
version already installed  it always says that i created a little sscript
(http authentication) to test when i run it > http 500 what is this ??

regards from belgium
Erik


--- End Message ---

Reply via email to