php-windows Digest 25 Jul 2001 23:42:12 -0000 Issue 668

Topics (messages 8496 through 8510):

latest version of PHP won't let you....
        8496 by: G Schneider
        8497 by: Glenn Pickett
        8499 by: G Schneider

Re: Problem with Session_Start() and Netscape 4.7
        8498 by: Svemir

php on W2K server
        8500 by: Austin Pichot
        8503 by: Frank M. Kromann

problems returning varchars in MSSQL bigger than 255 chars
        8501 by: Hugo Alexandre Almeida Soares Dias
        8502 by: Frank M. Kromann

Slow MSSQL access when using TCP/IP
        8504 by: Jah Raphael
        8505 by: Jah Raphael
        8506 by: Andrian Pervazov
        8507 by: Jah Raphael

php binary compiled with mysql 3.23.39 or higher
        8508 by: Gaylen Fraley

Regular Expressions
        8509 by: Siobhan Sweeney
        8510 by: Nintendoodle

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]


----------------------------------------------------------------------


After installing the latest version of PHP for windows,
I have found that it won't let you use the exec() function.

e.g. if you want to delete a file on a windows server, you would use
exec("del $file"); rather than unlink("$file") which is for UNIX based
servers.

Or am I wrong and there is just a setting that needs to be enabled in
php.ini file?

This is quite an important thing, really.

?


++++++++++++++++++++++++++++++++++++++++
http://www.webmastersdog.com
where website owners go. and talk about stuff.
++++++++++++++++++++++++++++++++++++++++







"Del" is a DOS command.  Try:

exec ("cmd.exe /c del $file");             for NT and W2K or
exec("command.com /c del $file");      for Windows 9X and ME

Glenn

"G Schneider" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> After installing the latest version of PHP for windows,
> I have found that it won't let you use the exec() function.
>
> e.g. if you want to delete a file on a windows server, you would use
> exec("del $file"); rather than unlink("$file") which is for UNIX based
> servers.
>
> Or am I wrong and there is just a setting that needs to be enabled in
> php.ini file?
>
> This is quite an important thing, really.
>
> ?
>
>
> ++++++++++++++++++++++++++++++++++++++++
> http://www.webmastersdog.com
> where website owners go. and talk about stuff.
> ++++++++++++++++++++++++++++++++++++++++
>
>






Thank you for your reply.

I have since discovered that the latest version of PHP (4.0.6) has actually
*enabled* the unlink() function! So it's not just for UNIX anymore! But it
has also *disabled* the exec("del $file"); way of doing it! What I want to
know is why isn't it mentioned in the changes log at the php.net website?


++++++++++++++++++++++++++++++++++++++++
http://www.webmastersdog.com
where website owners go. and talk about stuff.
++++++++++++++++++++++++++++++++++++++++
"Glenn Pickett" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> "Del" is a DOS command.  Try:
>
> exec ("cmd.exe /c del $file");             for NT and W2K or
> exec("command.com /c del $file");      for Windows 9X and ME
>
> Glenn
>
> "G Schneider" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > After installing the latest version of PHP for windows,
> > I have found that it won't let you use the exec() function.
> >
> > e.g. if you want to delete a file on a windows server, you would use
> > exec("del $file"); rather than unlink("$file") which is for UNIX based
> > servers.
> >
> > Or am I wrong and there is just a setting that needs to be enabled in
> > php.ini file?
> >
> > This is quite an important thing, really.
> >
> > ?
> >
> >
> > ++++++++++++++++++++++++++++++++++++++++
> > http://www.webmastersdog.com
> > where website owners go. and talk about stuff.
> > ++++++++++++++++++++++++++++++++++++++++
> >
> >
>
>






> why starting sessions results with page reloading on Netscape?

I think it does not have anything to do with sessions. Some versions
of Netscape simply always reload some pages. I have a site that does
not use sessions, but the same problem happens - just as the download
is finishing, the whole thing "blinks" for a second, and if it was POSTed,
I get the same "error" as you do.

Tried playing with server directives for expiring and caching, but it
seems that Netscape and the server can't agree whether to use the
server's time or local time, so results are unpredictable...

I guess some tags in the header of the html (pragma and stuff) might
work, but I still did not try that, mostly because it is "discouraged" by
the standards, and you would still have troubles if your visitors are
using a proxy server or something like that.

Svemir Brkic
www.baltok.com
Delivering Your Vision to the World Wide Web





Can you install PHP on W2K server running IIS?

I tried, it looked like it all worked until the end of the install. I got a
message saying that it was unable to configure IIS and that it needed to be
done manualy per the install.txt file. I looked in the install.txt file and
see no refrence to W2K server only W2K pro.

Thanks
Austin






Hi,

IIS is the same on Windows 2000 server and Pro. The only difference is on the Pro 
version you can only have one web site.

I use PHP on both types (doing only manual install though).

- Frank

> Can you install PHP on W2K server running IIS?
> 
> I tried, it looked like it all worked until the end of the install. I got a
> message saying that it was unable to configure IIS and that it needed to be
> done manualy per the install.txt file. I looked in the install.txt file and
> see no refrence to W2K server only W2K pro.
> 
> Thanks
> Austin
> 
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> 








Hi,

I have a problem with my code. When i use Varchars larger than 255 PHP only
fetches the top 255 chars.

Does anyone knows where's my problem?

I use PHP4+IIS+SQL Server 2k.

Thank you in advance


Hugo Alexandre Dias
Eng. Sistemas Informática
[EMAIL PROTECTED]




Hi,

The problem is in the Microsoft libraries used in the MSSQL extension. These libraries 
was created for SQL Server 6.0 and has not been updated since.

New data types and features was added in SQL Server 7.0 and 2000, but thd DB-Library 
was not updated.

So far the only solution is to use COM and ADODB or ODBC to get by this.

- Frank

> 
> Hi,
> 
> I have a problem with my code. When i use Varchars larger than 255 PHP only
> fetches the top 255 chars.
> 
> Does anyone knows where's my problem?
> 
> I use PHP4+IIS+SQL Server 2k.
> 
> Thank you in advance
> 
> 
> Hugo Alexandre Dias
> Eng. Sistemas Informática
> [EMAIL PROTECTED]
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> 







Hello! :)

I've run into a problem where connecting to our MSSQL Server from our
webserver using a TCP/IP connection is a -whole- lot slower than 
connecting to the same server using a Named Pipes connection (we're 
talking 10 to 20 times slower).

We are running SQL server on a non-standard port (1533 vs 1433). I
do believe we had tried running it on port 1433 and still had the
slowdown though.

In the Client Configuration utility on the WEB server I use the 
following settings:

Server Alias: mssql_named_pipes
Network Library: Named Pipes
Connection parameters: \\sqlserver\pipe\sql\query

Server Alias: mssql_tcpip
Network Library: TCP/IP
Connection parameters: 192.168.1.7,1533

I want to make sure to point out that everything -does- operate fine 
when using the TCP/IP connection - it's just extremely slow.

We've tried connecting to other MSSQL servers and ran into the same 
problems where it will run fast when using Named Pipes, but slow when 
using TCP/IP.

Here is are 3 benchmarks of just the mssql_connect() between Named 
Pipes and TCP/IP versions so you can see how much slower it is. This is

a sample of running it three times (I've run this from the web and from

command line and gotten the same results both times):

Named Pipes took 13.3231ms
TCP/IP took 205.6559ms

Named Pipes took 12.3510ms
TCP/IP took 174.2430ms

Named Pipes took 13.2550ms
TCP/IP took 149.0561ms

Here's the code that generated the above:

-- snip snip --

function DoBenchmark( $name, $server, $numtimes )
{
 $start_time = getmicrotime();
 for ( $i = 0; $i < $numtimes; ++$i ) {
  $link_id = mssql_connect( $server, DATABASE_USER, DATABASE_PASSWORD
);
  if ( !$link_id )
   exit;
  mssql_close( $link_id );
 }
 $total_ms = ( getmicrotime() - $start_time ) * 1000;
 printf( "$name took %.4fms<br>", $total_ms );
}

function getmicrotime() 
{
 list( $usec, $sec ) = explode( " " , microtime() );
 return (float)$usec + (float)$sec;
}

DoBenchmark( "Named Pipes", "mssql_named_pipes", $runs );
DoBenchmark( "TCP/IP",      "mssql_tcpip",       $runs );

-- snip snip --

Finally, here's the web server and sql server information:

SQL Server OS: Win2K Server SP1
SQL Version: MSSQL 7.0

WEB Server OS: Win2K Server SP2
WEB Server PHP: PHP 4.0.6 w/ latest extensions
WEB Server: IIS 5.0

We are using PHP in CGI mode.

The PHP.exe is compiled in-house, however there are no MSSQL related 
changes in our version.

Here are the results of "php -m":

Running PHP 4.0.6
Zend Engine v1.0.6, Copyright (c) 1998-2001 Zend Technologies
    with Zend Optimizer v1.1.0, Copyright (c) 1998-2000, by Zend
Technologies

[PHP Modules]
standard
bcmath
Calendar
com
variant
ftp
mysql
odbc
pcre
session
xml
wddx
gd
mssql
Zend Optimizer

[Zend Modules]
Zend Optimizer

--

>From what I've been reading it sounds like there are a good number
of people who successfully use TCP/IP connections to MSSQL, so it
sounds like I may just be doing something wrong - I just don't know
what.

I hope that explains the problem. All I want is to be able to connect
to the MSSQL server using TCP/IP and not suffer the slowdowns we're
currently suffering :)

Thanks in advance for any help.

-Jah

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/




Hello! :)

I've run into a problem where connecting to our MSSQL Server from our
webserver using a TCP/IP connection is a -whole- lot slower than 
connecting to the same server using a Named Pipes connection (we're 
talking 10 to 20 times slower).

We are running SQL server on a non-standard port (1533 vs 1433). I
do believe we had tried running it on port 1433 and still had the
slowdown though.

In the Client Configuration utility on the WEB server I use the following 
settings:

Server Alias: mssql_named_pipes
Network Library: Named Pipes
Connection parameters: \\sqlserver\pipe\sql\query

Server Alias: mssql_tcpip
Network Library: TCP/IP
Connection parameters: 192.168.1.7,1533

I want to make sure to point out that everything -does- operate fine when
using the TCP/IP connection - it's just extremely slow.

We've tried connecting to other MSSQL servers and ran into the same problems 
where it will run fast when using Named Pipes, but slow when using TCP/IP.

Here is are 3 benchmarks of just the mssql_connect() between Named Pipes and 
TCP/IP versions so you can see how much slower it is. This is a sample of running
it three times (I've run this from the web and from command line and gotten the
same results both times):

Named Pipes took 13.3231ms
TCP/IP took 205.6559ms

Named Pipes took 12.3510ms
TCP/IP took 174.2430ms

Named Pipes took 13.2550ms
TCP/IP took 149.0561ms

Here's the code that generated the above:

-- snip snip --

function DoBenchmark( $name, $server, $numtimes )
{
 $start_time = getmicrotime();
 for ( $i = 0; $i < $numtimes; ++$i ) {
  $link_id = mssql_connect( $server, DATABASE_USER, DATABASE_PASSWORD );
  if ( !$link_id )
   exit;
  mssql_close( $link_id );
 }
 $total_ms = ( getmicrotime() - $start_time ) * 1000;
 printf( "$name took %.4fms<br>", $total_ms );
}

function getmicrotime() 
{
 list( $usec, $sec ) = explode( " " , microtime() );
 return (float)$usec + (float)$sec;
}

DoBenchmark( "Named Pipes", "mssql_named_pipes", $runs );
DoBenchmark( "TCP/IP",      "mssql_tcpip",       $runs );

-- snip snip --

Finally, here's the web server and sql server information:

SQL Server OS: Win2K Server SP1
SQL Version: MSSQL 7.0

WEB Server OS: Win2K Server SP2
WEB Server PHP: PHP 4.0.6 w/ latest extensions
WEB Server: IIS 5.0

We are using PHP in CGI mode.

The PHP.exe is compiled in-house, however there are no MSSQL related 
changes in our version.

Here are the results of "php -m":

Running PHP 4.0.6
Zend Engine v1.0.6, Copyright (c) 1998-2001 Zend Technologies
    with Zend Optimizer v1.1.0, Copyright (c) 1998-2000, by Zend Technologies

[PHP Modules]
standard
bcmath
Calendar
com
variant
ftp
mysql
odbc
pcre
session
xml
wddx
gd
mssql
Zend Optimizer

[Zend Modules]
Zend Optimizer

--

>From what I've been reading it sounds like there are a good number
of people who successfully use TCP/IP connections to MSSQL, so it
sounds like I may just be doing something wrong - I just don't know
what.

I hope that explains the problem. All I want is to be able to connect
to the MSSQL server using TCP/IP and not suffer the slowdowns we're
currently suffering :)

Thanks in advance for any help.

-Jah




Does it really feel as slower? In principle, TCP should be even faster
than named pipes. Could the problem be somewhere? My expreience shows
that microtime() doesn't work predictable on Windows. The sec and
microsec part of its output are out of sync. Very often you can get a
negative value when trying to measure a time interval etc. So, is there
some chance this is affecting the measurement?

Andrian

Jah Raphael wrote:
> 
> Hello! :)
> 
> I've run into a problem where connecting to our MSSQL Server from our
> webserver using a TCP/IP connection is a -whole- lot slower than
> connecting to the same server using a Named Pipes connection (we're
> talking 10 to 20 times slower).
> 
> We are running SQL server on a non-standard port (1533 vs 1433). I
> do believe we had tried running it on port 1433 and still had the
> slowdown though.
> 
> In the Client Configuration utility on the WEB server I use the
> following
> settings:
> 
> Server Alias: mssql_named_pipes
> Network Library: Named Pipes
> Connection parameters: \\sqlserver\pipe\sql\query
> 
> Server Alias: mssql_tcpip
> Network Library: TCP/IP
> Connection parameters: 192.168.1.7,1533
> 
> I want to make sure to point out that everything -does- operate fine
> when
> using the TCP/IP connection - it's just extremely slow.
> 
> We've tried connecting to other MSSQL servers and ran into the same
> problems
> where it will run fast when using Named Pipes, but slow when using
> TCP/IP.
> 
> Here is are 3 benchmarks of just the mssql_connect() between Named Pipes
> and
> TCP/IP versions so you can see how much slower it is. This is a sample
> of running
> it three times (I've run this from the web and from command line and
> gotten the
> same results both times):
> 
> Named Pipes took 13.3231ms
> TCP/IP took 205.6559ms
> 
> Named Pipes took 12.3510ms
> TCP/IP took 174.2430ms
> 
> Named Pipes took 13.2550ms
> TCP/IP took 149.0561ms
> 
> Here's the code that generated the above:
> 
> -- snip snip --
> 
> function DoBenchmark( $name, $server, $numtimes )
> {
>  $start_time = getmicrotime();
>  for ( $i = 0; $i < $numtimes; ++$i ) {
>   $link_id = mssql_connect( $server, DATABASE_USER, DATABASE_PASSWORD );
>   if ( !$link_id )
>    exit;
>   mssql_close( $link_id );
>  }
>  $total_ms = ( getmicrotime() - $start_time ) * 1000;
>  printf( "$name took %.4fms<br>", $total_ms );
> }
> 
> function getmicrotime()
> {
>  list( $usec, $sec ) = explode( " " , microtime() );
>  return (float)$usec + (float)$sec;
> }
> 
> DoBenchmark( "Named Pipes", "mssql_named_pipes", $runs );
> DoBenchmark( "TCP/IP",      "mssql_tcpip",       $runs );
> 
> -- snip snip --
> 
> Finally, here's the web server and sql server information:
> 
> SQL Server OS: Win2K Server SP1
> SQL Version: MSSQL 7.0
> 
> WEB Server OS: Win2K Server SP2
> WEB Server PHP: PHP 4.0.6 w/ latest extensions
> WEB Server: IIS 5.0
> 
> We are using PHP in CGI mode.
> 
> The PHP.exe is compiled in-house, however there are no MSSQL related
> changes in our version.
> 
> Here are the results of "php -m":
> 
> Running PHP 4.0.6
> Zend Engine v1.0.6, Copyright (c) 1998-2001 Zend Technologies
>     with Zend Optimizer v1.1.0, Copyright (c) 1998-2000, by Zend
> Technologies
> 
> [PHP Modules]
> standard
> bcmath
> Calendar
> com
> variant
> ftp
> mysql
> odbc
> pcre
> session
> xml
> wddx
> gd
> mssql
> Zend Optimizer
> 
> [Zend Modules]
> Zend Optimizer
> 
> --
> 
> >From what I've been reading it sounds like there are a good number
> of people who successfully use TCP/IP connections to MSSQL, so it
> sounds like I may just be doing something wrong - I just don't know
> what.
> 
> I hope that explains the problem. All I want is to be able to connect
> to the MSSQL server using TCP/IP and not suffer the slowdowns we're
> currently suffering :)
> 
> Thanks in advance for any help.
> 
> -Jah




It really does -feel- slower when running with a TCP/IP connection. Like
much much slower...

I used to have those problems with microtime() in PHP 4.0.5, but they were
fixed (clip
from http://www.php.net/ChangeLog-4.php):

. microtime() under Windows now returns accurate values. (James)

Yeah, I had expected TCP connections to run better (or at very least equal)
to their
Named Pipes counterparts, but it doesn't seem to be going that way for us
right now...

Any other suggestions? :)

-Jah

----- Original Message -----
From: "Andrian Pervazov" <[EMAIL PROTECTED]>
To: "Jah Raphael" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, July 25, 2001 3:44 PM
Subject: Re: [PHP-WIN] Slow MSSQL access when using TCP/IP


> Does it really feel as slower? In principle, TCP should be even faster
> than named pipes. Could the problem be somewhere? My expreience shows
> that microtime() doesn't work predictable on Windows. The sec and
> microsec part of its output are out of sync. Very often you can get a
> negative value when trying to measure a time interval etc. So, is there
> some chance this is affecting the measurement?
>
> Andrian
>
> Jah Raphael wrote:
> >
> > Hello! :)
> >
> > I've run into a problem where connecting to our MSSQL Server from our
> > webserver using a TCP/IP connection is a -whole- lot slower than
> > connecting to the same server using a Named Pipes connection (we're
> > talking 10 to 20 times slower).
> >
> > We are running SQL server on a non-standard port (1533 vs 1433). I
> > do believe we had tried running it on port 1433 and still had the
> > slowdown though.
> >
> > In the Client Configuration utility on the WEB server I use the
> > following
> > settings:
> >
> > Server Alias: mssql_named_pipes
> > Network Library: Named Pipes
> > Connection parameters: \\sqlserver\pipe\sql\query
> >
> > Server Alias: mssql_tcpip
> > Network Library: TCP/IP
> > Connection parameters: 192.168.1.7,1533
> >
> > I want to make sure to point out that everything -does- operate fine
> > when
> > using the TCP/IP connection - it's just extremely slow.
> >
> > We've tried connecting to other MSSQL servers and ran into the same
> > problems
> > where it will run fast when using Named Pipes, but slow when using
> > TCP/IP.
> >
> > Here is are 3 benchmarks of just the mssql_connect() between Named Pipes
> > and
> > TCP/IP versions so you can see how much slower it is. This is a sample
> > of running
> > it three times (I've run this from the web and from command line and
> > gotten the
> > same results both times):
> >
> > Named Pipes took 13.3231ms
> > TCP/IP took 205.6559ms
> >
> > Named Pipes took 12.3510ms
> > TCP/IP took 174.2430ms
> >
> > Named Pipes took 13.2550ms
> > TCP/IP took 149.0561ms
> >
> > Here's the code that generated the above:
> >
> > -- snip snip --
> >
> > function DoBenchmark( $name, $server, $numtimes )
> > {
> >  $start_time = getmicrotime();
> >  for ( $i = 0; $i < $numtimes; ++$i ) {
> >   $link_id = mssql_connect( $server, DATABASE_USER, DATABASE_PASSWORD );
> >   if ( !$link_id )
> >    exit;
> >   mssql_close( $link_id );
> >  }
> >  $total_ms = ( getmicrotime() - $start_time ) * 1000;
> >  printf( "$name took %.4fms<br>", $total_ms );
> > }
> >
> > function getmicrotime()
> > {
> >  list( $usec, $sec ) = explode( " " , microtime() );
> >  return (float)$usec + (float)$sec;
> > }
> >
> > DoBenchmark( "Named Pipes", "mssql_named_pipes", $runs );
> > DoBenchmark( "TCP/IP",      "mssql_tcpip",       $runs );
> >
> > -- snip snip --
> >
> > Finally, here's the web server and sql server information:
> >
> > SQL Server OS: Win2K Server SP1
> > SQL Version: MSSQL 7.0
> >
> > WEB Server OS: Win2K Server SP2
> > WEB Server PHP: PHP 4.0.6 w/ latest extensions
> > WEB Server: IIS 5.0
> >
> > We are using PHP in CGI mode.
> >
> > The PHP.exe is compiled in-house, however there are no MSSQL related
> > changes in our version.
> >
> > Here are the results of "php -m":
> >
> > Running PHP 4.0.6
> > Zend Engine v1.0.6, Copyright (c) 1998-2001 Zend Technologies
> >     with Zend Optimizer v1.1.0, Copyright (c) 1998-2000, by Zend
> > Technologies
> >
> > [PHP Modules]
> > standard
> > bcmath
> > Calendar
> > com
> > variant
> > ftp
> > mysql
> > odbc
> > pcre
> > session
> > xml
> > wddx
> > gd
> > mssql
> > Zend Optimizer
> >
> > [Zend Modules]
> > Zend Optimizer
> >
> > --
> >
> > >From what I've been reading it sounds like there are a good number
> > of people who successfully use TCP/IP connections to MSSQL, so it
> > sounds like I may just be doing something wrong - I just don't know
> > what.
> >
> > I hope that explains the problem. All I want is to be able to connect
> > to the MSSQL server using TCP/IP and not suffer the slowdowns we're
> > currently suffering :)
> >
> > Thanks in advance for any help.
> >
> > -Jah





Does anyone know where I can get hold of a php-4.0.6 binary (for windoz)
with an included mysql version higher than 3.23.32?  Thanks.

--
Gaylen








Just wondering if this would be correct, I am tring to use [p][ep] as regular 
expressions to be replace with an img tag, and i just want to know if it is possible 
to put in only the file name, and to have the location added through the eregi_replace 
as I have tried below

Thanks

eregi_replace("\[p]([-_./a-zA-Z0-9!&%#?,'=:~]+)\[ep]","<img 
scr=\"http://www.nintendoodle.com/graphics/\\1\";>",$text);




Just wondering if this would be correct, I am tring to use [p][ep] as regular 
expressions to be replace with an img tag, and i just want to know if it is possible 
to put in only the file name, and to have the location added through the eregi_replace 
as I have tried below

Thanks

eregi_replace("\[p]([-_./a-zA-Z0-9!&%#?,'=:~]+)\[ep]","<img 
scr=\"http://www.nintendoodle.com/graphics/\\1\";>",$text);


Reply via email to