php-windows Digest 17 Nov 2005 06:59:12 -0000 Issue 2827
Topics (messages 26494 through 26501):
Re: mssql tcp
26494 by: Joakim Ling
26497 by: Robert Twitty
Re: Command mode question
26495 by: Marc Ferguson
Re: Exec problem (using Winzip - command line)
26496 by: trystano.aol.com
26498 by: Chuck Anderson
Intercept image request
26499 by: Eric Frost
26500 by: Eric Frost
Double quotes and HTML
26501 by: Wayne Khan
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 ---
Sounds good, but where can I find a compiled library for windows? I search
freedts.org, only source code available?
-----Ursprungligt meddelande-----
Från: Frank M. Kromann [mailto:[EMAIL PROTECTED]
Skickat: den 16 november 2005 17:46
Till: Joakim Ling; php windows
Ämne: Re: SV: SV: [PHP-WIN] mssql tcp
Hi Jocke,
Well asuming that your problems are associated with msdblib. I'm using
msdblib too without any tcp problems so it could also be something else on
your system. This is a simple fix and it will work without changing code or
switching away from ISAPI. You might want to read this article
http://kromann.info/article.php?Id=11062598797760000
- Frank
> Hi
>
> Interesting, so if I swap mssql library to FreeTDS (never heard of this
before) my socket problem will disappear without changing the code?
>
> Do I have to change from ISAPI (IIS6) to CGI?
>
> // jocke
>
>
> -----Ursprungligt meddelande-----
> Från: Frank M. Kromann [mailto:[EMAIL PROTECTED]
> Skickat: den 15 november 2005 17:23
> Till: Joakim Ling
> Kopia: php windows; Robert Twitty
> Ämne: Re: SV: [PHP-WIN] mssql tcp
>
> Hi Jocke,
>
> Well I work with PHP and MSSQL and I know a bit about the broblems too.
> The library used to build the extension (msdblib) is not thread safe so
if
> you are using the extension on a hight trafic server under Apache or
ISAPI
> you might find odd problems. This has nothing to do with PHP. Using it
> under CGI or FastCGI will remove all these problems.
>
> Another solution would be to use the mssql extension with another
library.
> FreeTDS is providing an exelent replacement for msdblib. Look at
> http://kromann.info/php.php. The download site on the right hand side
> include this extension. It's called php_dblib.dll and it's a drop-in
> replacement for php_mssql.dll. No recoding required.
>
> - Frank
>
>
> > It doesn't matter, the problem lies within php. To solve this problem
> you have to use a client that usage pooling like ODBC -> MSSQL. So my
next
> step is to rewrite all mssql code to ODBC.
> >
> > This is not a problem if you run a small mssql server, buy if you
have
> over 100 databases with a lot of activity windows starts to act really
> strange because of a bug in php. (read more in Zend forum)
> >
> > But who works with php and mssql? :-) (except me)
> >
> > //Jocke
> >
> > -----Ursprungligt meddelande-----
> > Från: Robert Twitty [mailto:[EMAIL PROTECTED]
> > Skickat: den 15 november 2005 14:20
> > Till: Joakim Ling
> > Kopia: php windows
> > Ämne: Re: [PHP-WIN] mssql tcp
> >
> > Are you using mssql_pconnect() to connect to the database?
> >
> > -- bob
> >
> > On Mon, 14 Nov 2005, Joakim Ling wrote:
> >
> > > Hi
> > >
> > >
> > >
> > > When I connect to my MSSQL server (internal) with mssql_connect,
make
> a
> > > few queries etc and then close the connection link. It creates a
TCP
> > > connection each time (for every query). I'm running Win 2003 STD,
> IIS6,
> > > PHP5, MSSQL2000. The problem is that the connection doesn't close
> > > correctly so after a few minutes I will have a lot of TCP
connections
> > > that looks like this:
> > >
> > >
> > >
> > > (With "netstat -ap tcp")
> > >
> > > TCP w1new:22953 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22954 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22955 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22956 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22957 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22958 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22959 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22960 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22961 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22962 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22963 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22964 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22965 w1new:ms-sql-s TIME_WAIT
> > >
> > >
> > >
> > > After rebooting and running a few minutes the list is full and
> Windows
> > > begins to act really strange, not so strange when mssql has more
then
> > > 10000 TIME_WAIT connections waiting to close, but how to close
> them????
> > > mssql_close(); has no effect to this problem.
> > >
> > >
> > >
> > > I changed the TCPTimeWaitDelay value to 30 in regedit to increase
> > > connections, but still a huge problem. Anyone experience this
before
> or
> > > knows if converting to ODBC would work better?
> > >
> > >
> > >
> > >
> > >
> > > Best regards
> > >
> > > Joakim Ling
> > >
> > >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
>
>
>
--- End Message ---
--- Begin Message ---
It may and it may not. I now remember what causes this problem. When a
TCP connection is closed by the client application, the connection is not
completely terminated by the system. The connection is placed into the
TIME_WAIT state in case a packet needs to be resent because of a transport
error. The length (called socket linger time) of this state is system
dependent. However, the client app can set this time via the
SO_LINGER scoket option. Unfortunately, you cannot directly access the
underlying socket to do this with DB-Library.
This is not an uncommon problem, in fact, you will see the saem thing
occur if you run the script directly with the commond line PHP
interpreter. Whether or not this problem goes away with the FrreTDS
version depends on if it explicitly changes the socket's linger
timeout. In general you can just ignore this problem. IF it really is an
issue, and the FreeTDS version doesn't solve it, then you can try
ODBTP (http://odbtp.sourceforge.net). It prevents the occurance
of TIME_WAIT states, and the odbtp/mssql hybrid extension supports all the
mssql extension's functions.
-- bob
On Tue, 15 Nov 2005, Joakim Ling wrote:
> Hi
>
> Interesting, so if I swap mssql library to FreeTDS (never heard of this
> before) my socket problem will disappear without changing the code?
>
> Do I have to change from ISAPI (IIS6) to CGI?
>
> // jocke
>
>
> -----Ursprungligt meddelande-----
> Från: Frank M. Kromann [mailto:[EMAIL PROTECTED]
> Skickat: den 15 november 2005 17:23
> Till: Joakim Ling
> Kopia: php windows; Robert Twitty
> Ämne: Re: SV: [PHP-WIN] mssql tcp
>
> Hi Jocke,
>
> Well I work with PHP and MSSQL and I know a bit about the broblems too.
> The library used to build the extension (msdblib) is not thread safe so if
> you are using the extension on a hight trafic server under Apache or ISAPI
> you might find odd problems. This has nothing to do with PHP. Using it
> under CGI or FastCGI will remove all these problems.
>
> Another solution would be to use the mssql extension with another library.
> FreeTDS is providing an exelent replacement for msdblib. Look at
> http://kromann.info/php.php. The download site on the right hand side
> include this extension. It's called php_dblib.dll and it's a drop-in
> replacement for php_mssql.dll. No recoding required.
>
> - Frank
>
>
> > It doesn't matter, the problem lies within php. To solve this problem
> you have to use a client that usage pooling like ODBC -> MSSQL. So my next
> step is to rewrite all mssql code to ODBC.
> >
> > This is not a problem if you run a small mssql server, buy if you have
> over 100 databases with a lot of activity windows starts to act really
> strange because of a bug in php. (read more in Zend forum)
> >
> > But who works with php and mssql? :-) (except me)
> >
> > //Jocke
> >
> > -----Ursprungligt meddelande-----
> > Från: Robert Twitty [mailto:[EMAIL PROTECTED]
> > Skickat: den 15 november 2005 14:20
> > Till: Joakim Ling
> > Kopia: php windows
> > Ämne: Re: [PHP-WIN] mssql tcp
> >
> > Are you using mssql_pconnect() to connect to the database?
> >
> > -- bob
> >
> > On Mon, 14 Nov 2005, Joakim Ling wrote:
> >
> > > Hi
> > >
> > >
> > >
> > > When I connect to my MSSQL server (internal) with mssql_connect, make
> a
> > > few queries etc and then close the connection link. It creates a TCP
> > > connection each time (for every query). I'm running Win 2003 STD,
> IIS6,
> > > PHP5, MSSQL2000. The problem is that the connection doesn't close
> > > correctly so after a few minutes I will have a lot of TCP connections
> > > that looks like this:
> > >
> > >
> > >
> > > (With "netstat -ap tcp")
> > >
> > > TCP w1new:22953 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22954 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22955 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22956 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22957 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22958 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22959 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22960 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22961 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22962 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22963 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22964 w1new:ms-sql-s TIME_WAIT
> > >
> > > TCP w1new:22965 w1new:ms-sql-s TIME_WAIT
> > >
> > >
> > >
> > > After rebooting and running a few minutes the list is full and
> Windows
> > > begins to act really strange, not so strange when mssql has more then
> > > 10000 TIME_WAIT connections waiting to close, but how to close
> them????
> > > mssql_close(); has no effect to this problem.
> > >
> > >
> > >
> > > I changed the TCPTimeWaitDelay value to 30 in regedit to increase
> > > connections, but still a huge problem. Anyone experience this before
> or
> > > knows if converting to ODBC would work better?
> > >
> > >
> > >
> > >
> > >
> > > Best regards
> > >
> > > Joakim Ling
> > >
> > >
> >
> > --
> > 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
>
>
>
--- End Message ---
--- Begin Message ---
Hi Tony,
I tried cd \Program Files and cd "\Program files" and they worked. Try it
without the quotation marks.
Marc F.
"TonyY" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi, I have a sample question (I know I did before):
> I can nolonger use the command [>cd "\Program Files\Apache
> Group\Apache2\bin" to change the directory from the Command prompt????
> I got: Parameter format not correct - "\Program
> What I should do?
> Thanks,
> Tony
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
Are you getting anything in your Apache Error/Event logs?
Tryst
-----Original Message-----
From: Chuck Anderson <[EMAIL PROTECTED]>
To: [email protected]
Sent: Mon, 14 Nov 2005 16:31:57 -0700
Subject: [PHP-WIN] Exec problem (using Winzip - command line)
I wrote a script to backup my Thunderbird user profile every night by
zipping the whole profile (with subfolders) into a zip file.
I use exec to call Winzip with command line parameters (see -
http://www.memecode.com/docs/winzip.html)
The script worked fine until I tried it under my Apache 2.0
installation (I usually use 1.3). The exec command starts Winzip (I can
see it in task manager), but it just sits and pins - doing nothing. The
Php script times out.
I can not figure out what the problem could be. exec($cmd, $output,
$retval) with $cmd = 'dir 'works, as does changing $cmd to another
program in my Program Files folder. It appears that it is only Winzip
(in Program Files/WinZip) that will not work.
Any ideas what it could be?
-- PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
No. Nothing in either log file.
[EMAIL PROTECTED] wrote:
Are you getting anything in your Apache Error/Event logs?
Tryst
-----Original Message-----
From: Chuck Anderson <[EMAIL PROTECTED]>
To: [email protected]
Sent: Mon, 14 Nov 2005 16:31:57 -0700
Subject: [PHP-WIN] Exec problem (using Winzip - command line)
I wrote a script to backup my Thunderbird user profile every night by
zipping the whole profile (with subfolders) into a zip file.
I use exec to call Winzip with command line parameters (see -
http://www.memecode.com/docs/winzip.html)
The script worked fine until I tried it under my Apache 2.0
installation (I usually use 1.3). The exec command starts Winzip (I can
see it in task manager), but it just sits and pins - doing nothing. The
Php script times out.
I can not figure out what the problem could be. exec($cmd, $output,
$retval) with $cmd = 'dir 'works, as does changing $cmd to another
program in my Program Files folder. It appears that it is only Winzip
(in Program Files/WinZip) that will not work.
Any ideas what it could be?
-- PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I want to intercept an image request from other web sites, runs some PHP,
and then actually go ahead and serve the image request.
I have ISAPIRewrite installed so I put in this
RewriteRule /m.png /m.php
This part is fine.
To serve the image I tried --
<?
// do my php stuff
?>
<img src=m1.png>
I use m1.png so the request is not looping back on itself. :-)
It seems like this should work but it doesn't work from other web site. I
think because they are expecting a raw image.
So.. is this the way to go ? --
http://php.mirrors.ilisys.com.au/manual/en/function.imagepng.php
right in the PHP code run --
<?php
$im = imagecreatefrompng("test.png");
imagepng($im);
?>
for some reason I can't get it to work for the last few hours! Anyway, if
you could at least tell me if I'm on the right track I'll keep at it.
Thanks!
Eric
http://www.mp2kmag.com
--- End Message ---
--- Begin Message ---
This did the trick --
http://john.ellingsworth.org/?p=18
Thanks John!
My php code ended up being --
<?
// bunch of stuff
header("Content-type: image/png");
$path = "c:/websites/mp2kmag/m1.png";
//OPEN THE IMAGEFILE
$mypng = fopen($path,"r");
//READ THE IMAGEFILE
$image = fread($mypng,filesize($path));
//SEND IT DOWN THE PIPE
echo $image;
?>
My rewrite rule using Helicon's ISAPIrewrite is
RewriteRule /m.png /m.asp
So when you open this image --
http://www.mp2kmag.com/m.png
it runs the code and then ends up serving
http://www.mp2kmag.com/m1.png
(again just because I didn't want the rewrite to loop back on itself).
Thanks,
Eric
http://www.linkbliss.com
http://www.ericfrost.com
--- End Message ---
--- Begin Message ---
Hi all,
I'm rather new to PHP... Am taking a maximal PHP, minimal HTML approach;
came from a C/Java background.
I'm use a staged (e.g. stage1, stage2) forms page for the creation of new
user accounts, so I'm getting variables out of $_POST if there are any.
Problem is... I'm getting a weird parse error:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in ...
My code is as follows:
1 if (isset($_POST["user_id"]))
2 echo "<br><input type='text' name='user_id' size='40'
maxlength='15' value='$_POST[\"user_id\"]'>";
3 else
4 echo "<br><input type='text' name='user_id' size='40'
maxlength='15'>";
I know it has something to do with line 2, because HTML does not support the
use of slashes to escape double quotes. I guess the solution would be to
simply declare an additional variable and refer to it in the if..else part.
1 $user_id = $_POST["user_id"];
2
3 if (isset($_POST["user_id"]))
4 echo "<br><input type='text' name='user_id' size='40'
maxlength='15' value='$user_id'>";
5 else
6 echo "<br><input type='text' name='user_id' size='40'
maxlength='15'>";
But it just seems so... Inelegant. Is there anyway I can just refer to
$_POST variables directly, instead of having to declare a new variable?
Thanks a lot! =)
--- End Message ---