php-windows Digest 7 Aug 2003 01:20:41 -0000 Issue 1857
Topics (messages 21034 through 21051):
Re: PHP 4.3.2, Windows 2000 IIS 5, MySQL 4.013 CPU usage problem
21034 by: Miha Nedok
21040 by: Gary Broughton
21042 by: Cesar Cordovez
21046 by: Sek-Mun Wong
21047 by: Gary Broughton
21048 by: Sek-Mun Wong
21049 by: Gary Broughton
21051 by: Sek-Mun Wong
Re: how to delete file in windows
21035 by: Aidal
21036 by: Aidal
Re: unable to delete php created files in php
21037 by: Aidal
PHP and Win 2003 Server
21038 by: Sergio Fontes
Making a service with php
21039 by: John Yu
21041 by: Svensson, B.A.T. (HKG)
21043 by: Luis Moreira
21044 by: John Yu
21045 by: Luis Moreira
21050 by: John Yu
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 ---
I agree with running ISAPI it's very stable. I have tested 100000
connections with up to 100 concurrent ( reading and writing to a database
) and the test was successful.
-Mike
On Wed, 6 Aug 2003, Sek-Mun Wong wrote:
> Date: Wed, 6 Aug 2003 18:50:23 +1000
> From: Sek-Mun Wong <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Re: PHP 4.3.2, Windows 2000 IIS 5,
> MySQL 4.013 CPU usage problem
>
> are you running php4isapi.dll (ISAPI) or php.exe (CGI) version?
>
> I know people recommend CGI, but post 4.2.3, the ISAPI version is very
> stable and you'd be nuts to run a busy site in CGI mode.
>
> If you're running CGI, here is an explanation:
> The most expensive operation is the *connection*, why mysql gets flogged is
> because every time you close down a php script, it dies and the connection
> dies, so a new one needs to be re-established. It can take only 10-20
> concurrent connections to kill the server.
>
> To "fix" this (it's more an infrastructure issue, really):
>
> 1) run ISAPI version of php
> 2) under [MySql] in php.ini, make sure
>
> mysql.allow_persistent = On
>
> You'll be amazed at the difference.
>
>
> "Gary Broughton" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > I wonder if anyone could offer any advice. We have a series of message
> > boards using a MySQL database running under ASP on Windows 2000 IIS 5
> fine.
> > Today I put the a PHP version live after it had been tested over the
> weekend
> > with about 20 users. As soon as I enabled PHP on the live website
> (separate
> > to the test PHP already running), the CPU usage for MySQL-nt went up to
> 100%
> > constantly, making the site run at a crawl. After uninstalling PHP and
> > reverting to the ASP version for the live site, it all ran smoothly again.
> > I have the Application set to Low (IIS Process) on both sites, the
> > cgi.force_redirect is 0 as required, and the machine is a dual 1.8G
> Pentium
> > with 512MB of memory (I know this could do with doubling, but why is it
> okay
> > running ASP code?). I've scoured the net looking for any suggestions, but
> > without coming across anything concrete. Has anyone any ideas I could try
> > out at all?
> > Many thanks
> > Gary Broughton
> >
> >
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Hi guys
Many thanks for your replies. I did originally use the CGI version, but
earlier today built a second machine, and clean installed IIS5 and PHP
4.3.2 onto it, using the ISAPI module - and now connect to the remote
MySQL database.
Unfortunately, I'm getting pretty much the same 100% usage from the
mysqld-nt on the database server (although it occasionally drops for a
few seconds every minute or two). I've also tried mysqld-max-nt and
mysqld-opt, but there is no difference.
I use the 'mysql_pconnect()' option on my php pages, and indeed the
'mysql.allow.persistent' is set to 'on'. I just don't get it,
especially as the ASP version runs efficiently! Confused and
frustrated!
It's probably going to simply need another parameter or two setting, but
I'll be damned if I can find the answer!
Any more suggestions would be more than welcome.
"Sek-Mun Wong" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
> are you running php4isapi.dll (ISAPI) or php.exe (CGI) version?
>
> I know people recommend CGI, but post 4.2.3, the ISAPI version is very
> stable and you'd be nuts to run a busy site in CGI mode.
>
> If you're running CGI, here is an explanation:
> The most expensive operation is the *connection*, why mysql gets
> flogged is because every time you close down a php script, it dies and
> the connection dies, so a new one needs to be re-established. It can
> take only 10-20 concurrent connections to kill the server.
>
> To "fix" this (it's more an infrastructure issue, really):
>
> 1) run ISAPI version of php
> 2) under [MySql] in php.ini, make sure
>
> mysql.allow_persistent = On
>
> You'll be amazed at the difference.
>
>
> "Gary Broughton" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > I wonder if anyone could offer any advice. We have a series of
> > message boards using a MySQL database running under ASP on Windows
> > 2000 IIS 5
> fine.
> > Today I put the a PHP version live after it had been tested over the
> weekend
> > with about 20 users. As soon as I enabled PHP on the live website
> (separate
> > to the test PHP already running), the CPU usage for MySQL-nt went up
> > to
> 100%
> > constantly, making the site run at a crawl. After uninstalling PHP
> > and reverting to the ASP version for the live site, it all ran
> > smoothly again. I have the Application set to Low (IIS Process) on
> > both sites, the cgi.force_redirect is 0 as required, and the machine
> > is a dual 1.8G
> Pentium
> > with 512MB of memory (I know this could do with doubling, but why is
> > it
> okay
> > running ASP code?). I've scoured the net looking for any
> > suggestions, but without coming across anything concrete. Has
> > anyone any ideas I could try out at all? Many thanks
> > Gary Broughton
> >
> >
>
--- End Message ---
--- Begin Message ---
Maybe your servers are ok but the connection between them is slow?
Broken? Firewalls?
Gary Broughton wrote:
Hi guys
Many thanks for your replies. I did originally use the CGI version, but
earlier today built a second machine, and clean installed IIS5 and PHP
4.3.2 onto it, using the ISAPI module - and now connect to the remote
MySQL database.
Unfortunately, I'm getting pretty much the same 100% usage from the
mysqld-nt on the database server (although it occasionally drops for a
few seconds every minute or two). I've also tried mysqld-max-nt and
mysqld-opt, but there is no difference.
I use the 'mysql_pconnect()' option on my php pages, and indeed the
'mysql.allow.persistent' is set to 'on'. I just don't get it,
especially as the ASP version runs efficiently! Confused and
frustrated!
It's probably going to simply need another parameter or two setting, but
I'll be damned if I can find the answer!
Any more suggestions would be more than welcome.
"Sek-Mun Wong" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
are you running php4isapi.dll (ISAPI) or php.exe (CGI) version?
I know people recommend CGI, but post 4.2.3, the ISAPI version is very
stable and you'd be nuts to run a busy site in CGI mode.
If you're running CGI, here is an explanation:
The most expensive operation is the *connection*, why mysql gets
flogged is because every time you close down a php script, it dies and
the connection dies, so a new one needs to be re-established. It can
take only 10-20 concurrent connections to kill the server.
To "fix" this (it's more an infrastructure issue, really):
1) run ISAPI version of php
2) under [MySql] in php.ini, make sure
mysql.allow_persistent = On
You'll be amazed at the difference.
"Gary Broughton" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I wonder if anyone could offer any advice. We have a series of
message boards using a MySQL database running under ASP on Windows
2000 IIS 5
fine.
Today I put the a PHP version live after it had been tested over the
weekend
with about 20 users. As soon as I enabled PHP on the live website
(separate
to the test PHP already running), the CPU usage for MySQL-nt went up
to
100%
constantly, making the site run at a crawl. After uninstalling PHP
and reverting to the ASP version for the live site, it all ran
smoothly again. I have the Application set to Low (IIS Process) on
both sites, the cgi.force_redirect is 0 as required, and the machine
is a dual 1.8G
Pentium
with 512MB of memory (I know this could do with doubling, but why is
it
okay
running ASP code?). I've scoured the net looking for any
suggestions, but without coming across anything concrete. Has
anyone any ideas I could try out at all? Many thanks
Gary Broughton
--- End Message ---
--- Begin Message ---
a 100% cpu process is pretty rude, I don't think that the network bandwidth
(even if it is only 10Mpbs) would cause your problem, so I doubt that's it.
Ok, check the following:
1) max connections setting in mysql (might be out of connections)
2) check physical memory remaining (rogue process? see (4))
3) are you using table locks? (deadlock issues?, if you have to lock, try
not using pconnect for those transactions)
4) do mysql_free_result when you're done with large queries (just in case, I
think php should do garbage collection properly)
5) can you see the number of / what processes/queries are running the the
mysql daemon?
6) have you gone through your web logs to see if there's unusual activity?
You say the ASP version behaves, but obviously the code is doing something
different, funny because I assume that in asp you're using odbc to connect
to mysql? it *is* weird to get this problem in php and not asp.
fwiw we run about a dozen virutal hosts, about 1500 page views per day each
site, IIS, dual p3-933, 1Gb RAM, php4.3.2, mysql 4.0.12 and the server
hardly touches 10% at any time. It's all persistent connections, and the
mysql daemon is on the same box. Our sql is intense, but streamlined.
We also "pool" (it's not true persitent pooling, but per page invocation)
connections in our framework so a pconnect is done once per framework call
(ie, per page). But we religiously free_result all the time when we're
done... haven't tried leaving this out so I can't tell if that's a real
factor.
That's probably the key, it's hard to tell without seeing how you run your
sql or how the pages are designed.
"Gary Broughton" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi guys
>
> Many thanks for your replies. I did originally use the CGI version, but
> earlier today built a second machine, and clean installed IIS5 and PHP
> 4.3.2 onto it, using the ISAPI module - and now connect to the remote
> MySQL database.
>
> Unfortunately, I'm getting pretty much the same 100% usage from the
> mysqld-nt on the database server (although it occasionally drops for a
> few seconds every minute or two). I've also tried mysqld-max-nt and
> mysqld-opt, but there is no difference.
>
> I use the 'mysql_pconnect()' option on my php pages, and indeed the
> 'mysql.allow.persistent' is set to 'on'. I just don't get it,
> especially as the ASP version runs efficiently! Confused and
> frustrated!
>
> It's probably going to simply need another parameter or two setting, but
> I'll be damned if I can find the answer!
>
> Any more suggestions would be more than welcome.
>
>
> "Sek-Mun Wong" <[EMAIL PROTECTED]> wrote in message
> news:<[EMAIL PROTECTED]>...
> > are you running php4isapi.dll (ISAPI) or php.exe (CGI) version?
> >
> > I know people recommend CGI, but post 4.2.3, the ISAPI version is very
>
> > stable and you'd be nuts to run a busy site in CGI mode.
> >
> > If you're running CGI, here is an explanation:
> > The most expensive operation is the *connection*, why mysql gets
> > flogged is because every time you close down a php script, it dies and
>
> > the connection dies, so a new one needs to be re-established. It can
> > take only 10-20 concurrent connections to kill the server.
> >
> > To "fix" this (it's more an infrastructure issue, really):
> >
> > 1) run ISAPI version of php
> > 2) under [MySql] in php.ini, make sure
> >
> > mysql.allow_persistent = On
> >
> > You'll be amazed at the difference.
> >
> >
> > "Gary Broughton" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > I wonder if anyone could offer any advice. We have a series of
> > > message boards using a MySQL database running under ASP on Windows
> > > 2000 IIS 5
> > fine.
> > > Today I put the a PHP version live after it had been tested over the
> > weekend
> > > with about 20 users. As soon as I enabled PHP on the live website
> > (separate
> > > to the test PHP already running), the CPU usage for MySQL-nt went up
>
> > > to
> > 100%
> > > constantly, making the site run at a crawl. After uninstalling PHP
> > > and reverting to the ASP version for the live site, it all ran
> > > smoothly again. I have the Application set to Low (IIS Process) on
> > > both sites, the cgi.force_redirect is 0 as required, and the machine
>
> > > is a dual 1.8G
> > Pentium
> > > with 512MB of memory (I know this could do with doubling, but why is
>
> > > it
> > okay
> > > running ASP code?). I've scoured the net looking for any
> > > suggestions, but without coming across anything concrete. Has
> > > anyone any ideas I could try out at all? Many thanks
> > > Gary Broughton
> > >
> > >
> >
>
--- End Message ---
--- Begin Message ---
Hi Sek-Mun (?)
My max_connections is set to 750 as it's for an online forum with an
average of 200/300 (I think). My my.ini is very simple and looks as
follows:
[mysqld]
basedir=C:/mysql
datadir=C:/mysql/data
max_connections=750
max_connect_errors=10000
Whereas in ASP I always issued an "oRsRecordset.Close" command, I have
replaced these with "mysql_free_result($resMessage2)", such as follows:
$sql = "SELECT username FROM users
WHERE user_id = '" . $_SESSION["UserID"] . "'";
$resUsers = mysql_query($sql) or die("Query failed [unable to locate
user details]" . mysql_error());
if (mysql_num_rows($resUsers) > 0) {
$oRsUsers = mysql_fetch_assoc($resUsers);
$strUserName = trim($oRsUsers["username"]);
} else {
$strUserName = "unknown";
}
mysql_free_result($resUsers);
However, I have noticed that a handful of the mysql processes are
sleeping with quite large millisecond "timeouts"(?)
i.e. | 2727 | mbuser | MESSAGEBOARD:1701 | messageboard | Sleep | 766
|.
The state is showing as NULL on each of them though, but does this
suggest I haven't freed them all up (although I've been through and
checked quite a few times)?
I've set the PHP session garbage collection at 5%. This is completely
alien to me, so I don't know if it should go any higher? All session
data is stored in one directory under c:\php\sessiondata\.
The web log / event viewer isn't showing anything that I believe to be
of significance.
Many many thanks for your advice, it is greatly appreciated.
Regards
Gary
"Sek-Mun Wong" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
> a 100% cpu process is pretty rude, I don't think that the network
> bandwidth (even if it is only 10Mpbs) would cause your problem, so I
> doubt that's it.
>
> Ok, check the following:
>
> 1) max connections setting in mysql (might be out of connections)
> 2) check physical memory remaining (rogue process? see (4))
> 3) are you using table locks? (deadlock issues?, if you have to lock,
> try not using pconnect for those transactions)
> 4) do mysql_free_result when you're done with large queries (just in
> case, I think php should do garbage collection properly)
> 5) can you see the number of / what processes/queries are running the
> the mysql daemon?
> 6) have you gone through your web logs to see if there's unusual
> activity?
>
> You say the ASP version behaves, but obviously the code is doing
> something different, funny because I assume that in asp you're using
> odbc to connect to mysql? it *is* weird to get this problem in php and
> not asp.
>
> fwiw we run about a dozen virutal hosts, about 1500 page views per day
> each site, IIS, dual p3-933, 1Gb RAM, php4.3.2, mysql 4.0.12 and the
> server hardly touches 10% at any time. It's all persistent
> connections, and the mysql daemon is on the same box. Our sql is
> intense, but streamlined.
>
> We also "pool" (it's not true persitent pooling, but per page
> invocation) connections in our framework so a pconnect is done once
> per framework call (ie, per page). But we religiously free_result all
> the time when we're done... haven't tried leaving this out so I can't
> tell if that's a real factor.
>
> That's probably the key, it's hard to tell without seeing how you run
> your sql or how the pages are designed.
>
>
> "Gary Broughton" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi guys
> >
> > Many thanks for your replies. I did originally use the CGI version,
> > but earlier today built a second machine, and clean installed IIS5
> > and PHP 4.3.2 onto it, using the ISAPI module - and now connect to
> > the remote MySQL database.
> >
> > Unfortunately, I'm getting pretty much the same 100% usage from the
> > mysqld-nt on the database server (although it occasionally drops for
> > a few seconds every minute or two). I've also tried mysqld-max-nt
> > and mysqld-opt, but there is no difference.
> >
> > I use the 'mysql_pconnect()' option on my php pages, and indeed the
> > 'mysql.allow.persistent' is set to 'on'. I just don't get it,
> > especially as the ASP version runs efficiently! Confused and
> > frustrated!
> >
> > It's probably going to simply need another parameter or two setting,
> > but I'll be damned if I can find the answer!
> >
> > Any more suggestions would be more than welcome.
> >
> >
> > "Sek-Mun Wong" <[EMAIL PROTECTED]> wrote in message
> > news:<[EMAIL PROTECTED]>...
> > > are you running php4isapi.dll (ISAPI) or php.exe (CGI) version?
> > >
> > > I know people recommend CGI, but post 4.2.3, the ISAPI version is
> > > very
> >
> > > stable and you'd be nuts to run a busy site in CGI mode.
> > >
> > > If you're running CGI, here is an explanation:
> > > The most expensive operation is the *connection*, why mysql gets
> > > flogged is because every time you close down a php script, it dies
> > > and
> >
> > > the connection dies, so a new one needs to be re-established. It
> > > can take only 10-20 concurrent connections to kill the server.
> > >
> > > To "fix" this (it's more an infrastructure issue, really):
> > >
> > > 1) run ISAPI version of php
> > > 2) under [MySql] in php.ini, make sure
> > >
> > > mysql.allow_persistent = On
> > >
> > > You'll be amazed at the difference.
> > >
> > >
> > > "Gary Broughton" <[EMAIL PROTECTED]> wrote in message
> > > news:[EMAIL PROTECTED]
> > > > I wonder if anyone could offer any advice. We have a series of
> > > > message boards using a MySQL database running under ASP on
> > > > Windows 2000 IIS 5
> > > fine.
> > > > Today I put the a PHP version live after it had been tested over
> > > > the
> > > weekend
> > > > with about 20 users. As soon as I enabled PHP on the live
> > > > website
> > > (separate
> > > > to the test PHP already running), the CPU usage for MySQL-nt
> > > > went up
> >
> > > > to
> > > 100%
> > > > constantly, making the site run at a crawl. After uninstalling
> > > > PHP and reverting to the ASP version for the live site, it all
> > > > ran smoothly again. I have the Application set to Low (IIS
> > > > Process) on both sites, the cgi.force_redirect is 0 as required,
> > > > and the machine
> >
> > > > is a dual 1.8G
> > > Pentium
> > > > with 512MB of memory (I know this could do with doubling, but
> > > > why is
> >
> > > > it
> > > okay
> > > > running ASP code?). I've scoured the net looking for any
> > > > suggestions, but without coming across anything concrete. Has
> > > > anyone any ideas I could try out at all? Many thanks Gary
> > > > Broughton
> > > >
> > > >
> > >
> >
>
--- End Message ---
--- Begin Message ---
don't think it would be a problem with mysql, (even if 750 connections is
waaaay too much!)
what's your wait_timeout set to (try something lower)? and how much physical
memory remains?
The fact that the processes are left running is not a good sign, try killing
some of these and see if the cpu comes down.
The last resort is to use only 1 connect per script execution to minimise
rogue processes.
Let me know how you go, I'd be interested in how to solve this issue
"Gary Broughton" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi Sek-Mun (?)
>
> My max_connections is set to 750 as it's for an online forum with an
> average of 200/300 (I think). My my.ini is very simple and looks as
> follows:
> [mysqld]
> basedir=C:/mysql
> datadir=C:/mysql/data
> max_connections=750
> max_connect_errors=10000
>
> Whereas in ASP I always issued an "oRsRecordset.Close" command, I have
> replaced these with "mysql_free_result($resMessage2)", such as follows:
> $sql = "SELECT username FROM users
> WHERE user_id = '" . $_SESSION["UserID"] . "'";
> $resUsers = mysql_query($sql) or die("Query failed [unable to locate
> user details]" . mysql_error());
> if (mysql_num_rows($resUsers) > 0) {
> $oRsUsers = mysql_fetch_assoc($resUsers);
> $strUserName = trim($oRsUsers["username"]);
> } else {
> $strUserName = "unknown";
> }
> mysql_free_result($resUsers);
>
> However, I have noticed that a handful of the mysql processes are
> sleeping with quite large millisecond "timeouts"(?)
> i.e. | 2727 | mbuser | MESSAGEBOARD:1701 | messageboard | Sleep | 766
> |.
> The state is showing as NULL on each of them though, but does this
> suggest I haven't freed them all up (although I've been through and
> checked quite a few times)?
>
> I've set the PHP session garbage collection at 5%. This is completely
> alien to me, so I don't know if it should go any higher? All session
> data is stored in one directory under c:\php\sessiondata\.
>
> The web log / event viewer isn't showing anything that I believe to be
> of significance.
>
> Many many thanks for your advice, it is greatly appreciated.
> Regards
> Gary
>
> "Sek-Mun Wong" <[EMAIL PROTECTED]> wrote in message
> news:<[EMAIL PROTECTED]>...
> > a 100% cpu process is pretty rude, I don't think that the network
> > bandwidth (even if it is only 10Mpbs) would cause your problem, so I
> > doubt that's it.
> >
> > Ok, check the following:
> >
> > 1) max connections setting in mysql (might be out of connections)
> > 2) check physical memory remaining (rogue process? see (4))
> > 3) are you using table locks? (deadlock issues?, if you have to lock,
> > try not using pconnect for those transactions)
> > 4) do mysql_free_result when you're done with large queries (just in
> > case, I think php should do garbage collection properly)
> > 5) can you see the number of / what processes/queries are running the
> > the mysql daemon?
> > 6) have you gone through your web logs to see if there's unusual
> > activity?
> >
> > You say the ASP version behaves, but obviously the code is doing
> > something different, funny because I assume that in asp you're using
> > odbc to connect to mysql? it *is* weird to get this problem in php and
>
> > not asp.
> >
> > fwiw we run about a dozen virutal hosts, about 1500 page views per day
>
> > each site, IIS, dual p3-933, 1Gb RAM, php4.3.2, mysql 4.0.12 and the
> > server hardly touches 10% at any time. It's all persistent
> > connections, and the mysql daemon is on the same box. Our sql is
> > intense, but streamlined.
> >
> > We also "pool" (it's not true persitent pooling, but per page
> > invocation) connections in our framework so a pconnect is done once
> > per framework call (ie, per page). But we religiously free_result all
> > the time when we're done... haven't tried leaving this out so I can't
> > tell if that's a real factor.
> >
> > That's probably the key, it's hard to tell without seeing how you run
> > your sql or how the pages are designed.
> >
> >
> > "Gary Broughton" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Hi guys
> > >
> > > Many thanks for your replies. I did originally use the CGI version,
>
> > > but earlier today built a second machine, and clean installed IIS5
> > > and PHP 4.3.2 onto it, using the ISAPI module - and now connect to
> > > the remote MySQL database.
> > >
> > > Unfortunately, I'm getting pretty much the same 100% usage from the
> > > mysqld-nt on the database server (although it occasionally drops for
>
> > > a few seconds every minute or two). I've also tried mysqld-max-nt
> > > and mysqld-opt, but there is no difference.
> > >
> > > I use the 'mysql_pconnect()' option on my php pages, and indeed the
> > > 'mysql.allow.persistent' is set to 'on'. I just don't get it,
> > > especially as the ASP version runs efficiently! Confused and
> > > frustrated!
> > >
> > > It's probably going to simply need another parameter or two setting,
>
> > > but I'll be damned if I can find the answer!
> > >
> > > Any more suggestions would be more than welcome.
> > >
> > >
> > > "Sek-Mun Wong" <[EMAIL PROTECTED]> wrote in message
> > > news:<[EMAIL PROTECTED]>...
> > > > are you running php4isapi.dll (ISAPI) or php.exe (CGI) version?
> > > >
> > > > I know people recommend CGI, but post 4.2.3, the ISAPI version is
> > > > very
> > >
> > > > stable and you'd be nuts to run a busy site in CGI mode.
> > > >
> > > > If you're running CGI, here is an explanation:
> > > > The most expensive operation is the *connection*, why mysql gets
> > > > flogged is because every time you close down a php script, it dies
>
> > > > and
> > >
> > > > the connection dies, so a new one needs to be re-established. It
> > > > can take only 10-20 concurrent connections to kill the server.
> > > >
> > > > To "fix" this (it's more an infrastructure issue, really):
> > > >
> > > > 1) run ISAPI version of php
> > > > 2) under [MySql] in php.ini, make sure
> > > >
> > > > mysql.allow_persistent = On
> > > >
> > > > You'll be amazed at the difference.
> > > >
> > > >
> > > > "Gary Broughton" <[EMAIL PROTECTED]> wrote in message
> > > > news:[EMAIL PROTECTED]
> > > > > I wonder if anyone could offer any advice. We have a series of
> > > > > message boards using a MySQL database running under ASP on
> > > > > Windows 2000 IIS 5
> > > > fine.
> > > > > Today I put the a PHP version live after it had been tested over
>
> > > > > the
> > > > weekend
> > > > > with about 20 users. As soon as I enabled PHP on the live
> > > > > website
> > > > (separate
> > > > > to the test PHP already running), the CPU usage for MySQL-nt
> > > > > went up
> > >
> > > > > to
> > > > 100%
> > > > > constantly, making the site run at a crawl. After uninstalling
> > > > > PHP and reverting to the ASP version for the live site, it all
> > > > > ran smoothly again. I have the Application set to Low (IIS
> > > > > Process) on both sites, the cgi.force_redirect is 0 as required,
>
> > > > > and the machine
> > >
> > > > > is a dual 1.8G
> > > > Pentium
> > > > > with 512MB of memory (I know this could do with doubling, but
> > > > > why is
> > >
> > > > > it
> > > > okay
> > > > > running ASP code?). I've scoured the net looking for any
> > > > > suggestions, but without coming across anything concrete. Has
> > > > > anyone any ideas I could try out at all? Many thanks Gary
> > > > > Broughton
> > > > >
> > > > >
> > > >
> > >
> >
>
--- End Message ---
--- Begin Message ---
Hi again
The reason I put the max_connections so high is that at 100 and 400 it
reached the limits and then crashed the site (too many connections) - so
that's simply to try and prevent that.
I'm not sure what 'wait_timeout' you mean? Is this a mysql or php ini
setting?
I killed a handful of tasks via MySQLCC, but didn't see any immediate drop
to be honest. It still stays at 100% most of the time, dropping to a
realistic changeable level every 10-20 seconds or so for around the same.
There's over 100Mb free physical memory at the moment after a few hours of
uptime (out of a total of 512Mb, which I hope to double anyway when the boss
gets me some more!).
I do only connect once to the database, via an include file at the top of
the page - I did have a close include at the bottom, but I believe this
would be ignored with a persistent connection anyway?
$boardlink = @mysql_pconnect("xxx", "xxx", "xxx") or die("Could not connect
" . mysql_error());
$boarddb = @mysql_select_db("xxx",$boardlink) or die("Could not select
messageboard database - " . mysql_error());
$newslink = @mssql_pconnect("xxx","xxx","xxx") or die("Could not connect -
");
$newsdb = @mssql_select_db("xxx",$newslink) or die("Could not select
article database ");
Again, many thanks for your time.
Regards
Gary
"Sek-Mun Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> don't think it would be a problem with mysql, (even if 750 connections is
> waaaay too much!)
>
> what's your wait_timeout set to (try something lower)? and how much
physical
> memory remains?
>
> The fact that the processes are left running is not a good sign, try
killing
> some of these and see if the cpu comes down.
>
> The last resort is to use only 1 connect per script execution to minimise
> rogue processes.
>
> Let me know how you go, I'd be interested in how to solve this issue
>
> "Gary Broughton" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi Sek-Mun (?)
> >
> > My max_connections is set to 750 as it's for an online forum with an
> > average of 200/300 (I think). My my.ini is very simple and looks as
> > follows:
> > [mysqld]
> > basedir=C:/mysql
> > datadir=C:/mysql/data
> > max_connections=750
> > max_connect_errors=10000
> >
> > Whereas in ASP I always issued an "oRsRecordset.Close" command, I have
> > replaced these with "mysql_free_result($resMessage2)", such as follows:
> > $sql = "SELECT username FROM users
> > WHERE user_id = '" . $_SESSION["UserID"] . "'";
> > $resUsers = mysql_query($sql) or die("Query failed [unable to locate
> > user details]" . mysql_error());
> > if (mysql_num_rows($resUsers) > 0) {
> > $oRsUsers = mysql_fetch_assoc($resUsers);
> > $strUserName = trim($oRsUsers["username"]);
> > } else {
> > $strUserName = "unknown";
> > }
> > mysql_free_result($resUsers);
> >
> > However, I have noticed that a handful of the mysql processes are
> > sleeping with quite large millisecond "timeouts"(?)
> > i.e. | 2727 | mbuser | MESSAGEBOARD:1701 | messageboard | Sleep | 766
> > |.
> > The state is showing as NULL on each of them though, but does this
> > suggest I haven't freed them all up (although I've been through and
> > checked quite a few times)?
> >
> > I've set the PHP session garbage collection at 5%. This is completely
> > alien to me, so I don't know if it should go any higher? All session
> > data is stored in one directory under c:\php\sessiondata\.
> >
> > The web log / event viewer isn't showing anything that I believe to be
> > of significance.
> >
> > Many many thanks for your advice, it is greatly appreciated.
> > Regards
> > Gary
> >
> > "Sek-Mun Wong" <[EMAIL PROTECTED]> wrote in message
> > news:<[EMAIL PROTECTED]>...
> > > a 100% cpu process is pretty rude, I don't think that the network
> > > bandwidth (even if it is only 10Mpbs) would cause your problem, so I
> > > doubt that's it.
> > >
> > > Ok, check the following:
> > >
> > > 1) max connections setting in mysql (might be out of connections)
> > > 2) check physical memory remaining (rogue process? see (4))
> > > 3) are you using table locks? (deadlock issues?, if you have to lock,
> > > try not using pconnect for those transactions)
> > > 4) do mysql_free_result when you're done with large queries (just in
> > > case, I think php should do garbage collection properly)
> > > 5) can you see the number of / what processes/queries are running the
> > > the mysql daemon?
> > > 6) have you gone through your web logs to see if there's unusual
> > > activity?
> > >
> > > You say the ASP version behaves, but obviously the code is doing
> > > something different, funny because I assume that in asp you're using
> > > odbc to connect to mysql? it *is* weird to get this problem in php and
> >
> > > not asp.
> > >
> > > fwiw we run about a dozen virutal hosts, about 1500 page views per day
> >
> > > each site, IIS, dual p3-933, 1Gb RAM, php4.3.2, mysql 4.0.12 and the
> > > server hardly touches 10% at any time. It's all persistent
> > > connections, and the mysql daemon is on the same box. Our sql is
> > > intense, but streamlined.
> > >
> > > We also "pool" (it's not true persitent pooling, but per page
> > > invocation) connections in our framework so a pconnect is done once
> > > per framework call (ie, per page). But we religiously free_result all
> > > the time when we're done... haven't tried leaving this out so I can't
> > > tell if that's a real factor.
> > >
> > > That's probably the key, it's hard to tell without seeing how you run
> > > your sql or how the pages are designed.
> > >
> > >
> > > "Gary Broughton" <[EMAIL PROTECTED]> wrote in message
> > > news:[EMAIL PROTECTED]
> > > > Hi guys
> > > >
> > > > Many thanks for your replies. I did originally use the CGI version,
> >
> > > > but earlier today built a second machine, and clean installed IIS5
> > > > and PHP 4.3.2 onto it, using the ISAPI module - and now connect to
> > > > the remote MySQL database.
> > > >
> > > > Unfortunately, I'm getting pretty much the same 100% usage from the
> > > > mysqld-nt on the database server (although it occasionally drops for
> >
> > > > a few seconds every minute or two). I've also tried mysqld-max-nt
> > > > and mysqld-opt, but there is no difference.
> > > >
> > > > I use the 'mysql_pconnect()' option on my php pages, and indeed the
> > > > 'mysql.allow.persistent' is set to 'on'. I just don't get it,
> > > > especially as the ASP version runs efficiently! Confused and
> > > > frustrated!
> > > >
> > > > It's probably going to simply need another parameter or two setting,
> >
> > > > but I'll be damned if I can find the answer!
> > > >
> > > > Any more suggestions would be more than welcome.
> > > >
> > > >
> > > > "Sek-Mun Wong" <[EMAIL PROTECTED]> wrote in message
> > > > news:<[EMAIL PROTECTED]>...
> > > > > are you running php4isapi.dll (ISAPI) or php.exe (CGI) version?
> > > > >
> > > > > I know people recommend CGI, but post 4.2.3, the ISAPI version is
> > > > > very
> > > >
> > > > > stable and you'd be nuts to run a busy site in CGI mode.
> > > > >
> > > > > If you're running CGI, here is an explanation:
> > > > > The most expensive operation is the *connection*, why mysql gets
> > > > > flogged is because every time you close down a php script, it dies
> >
> > > > > and
> > > >
> > > > > the connection dies, so a new one needs to be re-established. It
> > > > > can take only 10-20 concurrent connections to kill the server.
> > > > >
> > > > > To "fix" this (it's more an infrastructure issue, really):
> > > > >
> > > > > 1) run ISAPI version of php
> > > > > 2) under [MySql] in php.ini, make sure
> > > > >
> > > > > mysql.allow_persistent = On
> > > > >
> > > > > You'll be amazed at the difference.
> > > > >
> > > > >
> > > > > "Gary Broughton" <[EMAIL PROTECTED]> wrote in message
> > > > > news:[EMAIL PROTECTED]
> > > > > > I wonder if anyone could offer any advice. We have a series of
> > > > > > message boards using a MySQL database running under ASP on
> > > > > > Windows 2000 IIS 5
> > > > > fine.
> > > > > > Today I put the a PHP version live after it had been tested over
> >
> > > > > > the
> > > > > weekend
> > > > > > with about 20 users. As soon as I enabled PHP on the live
> > > > > > website
> > > > > (separate
> > > > > > to the test PHP already running), the CPU usage for MySQL-nt
> > > > > > went up
> > > >
> > > > > > to
> > > > > 100%
> > > > > > constantly, making the site run at a crawl. After uninstalling
> > > > > > PHP and reverting to the ASP version for the live site, it all
> > > > > > ran smoothly again. I have the Application set to Low (IIS
> > > > > > Process) on both sites, the cgi.force_redirect is 0 as required,
> >
> > > > > > and the machine
> > > >
> > > > > > is a dual 1.8G
> > > > > Pentium
> > > > > > with 512MB of memory (I know this could do with doubling, but
> > > > > > why is
> > > >
> > > > > > it
> > > > > okay
> > > > > > running ASP code?). I've scoured the net looking for any
> > > > > > suggestions, but without coming across anything concrete. Has
> > > > > > anyone any ideas I could try out at all? Many thanks Gary
> > > > > > Broughton
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
--- End Message ---
--- Begin Message ---
(I'm not ignoring you, it's just a timezone thing.)
wait_timeout is a mysql setting, it tells mysql to timeout and close an idle
connection after x seconds.
there is definitely something wrong if you get too many connections at 100
to 400 max_connections, that is extremely high - a reasonably busy and
persistent connection to an app should use no more than 30-50 - that's
heaps.
try restarting your mysql service when the counter hits 100% and see how
long it takes for connections to fill up, and if that measures accordingly
with hits on pages
you're right, the mysql_close doesn't (or shouldn't) do anything...
Other things to try,
a) upgrade to 4.014 (bugger me if that does anything),
b) set mysql query_cache_size so that common queries are cached (you can
allocate 8-12Mb to the cache for starters).
I doubt these will fix your problem, as you've pointed out, the asp bits are
already working.
The php bits look good, but you might want to remove the error suppression
and see if it's complaining about anything.
"Gary Broughton" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi again
>
> The reason I put the max_connections so high is that at 100 and 400 it
> reached the limits and then crashed the site (too many connections) - so
> that's simply to try and prevent that.
>
> I'm not sure what 'wait_timeout' you mean? Is this a mysql or php ini
> setting?
>
> I killed a handful of tasks via MySQLCC, but didn't see any immediate drop
> to be honest. It still stays at 100% most of the time, dropping to a
> realistic changeable level every 10-20 seconds or so for around the same.
>
> There's over 100Mb free physical memory at the moment after a few hours of
> uptime (out of a total of 512Mb, which I hope to double anyway when the
boss
> gets me some more!).
>
> I do only connect once to the database, via an include file at the top of
> the page - I did have a close include at the bottom, but I believe this
> would be ignored with a persistent connection anyway?
> $boardlink = @mysql_pconnect("xxx", "xxx", "xxx") or die("Could not
connect
> " . mysql_error());
> $boarddb = @mysql_select_db("xxx",$boardlink) or die("Could not select
> messageboard database - " . mysql_error());
> $newslink = @mssql_pconnect("xxx","xxx","xxx") or die("Could not
connect -
> ");
> $newsdb = @mssql_select_db("xxx",$newslink) or die("Could not select
> article database ");
>
> Again, many thanks for your time.
> Regards
> Gary
>
> "Sek-Mun Wong" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > don't think it would be a problem with mysql, (even if 750 connections
is
> > waaaay too much!)
> >
> > what's your wait_timeout set to (try something lower)? and how much
> physical
> > memory remains?
> >
> > The fact that the processes are left running is not a good sign, try
> killing
> > some of these and see if the cpu comes down.
> >
> > The last resort is to use only 1 connect per script execution to
minimise
> > rogue processes.
> >
> > Let me know how you go, I'd be interested in how to solve this issue
> >
> > "Gary Broughton" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Hi Sek-Mun (?)
> > >
> > > My max_connections is set to 750 as it's for an online forum with an
> > > average of 200/300 (I think). My my.ini is very simple and looks as
> > > follows:
> > > [mysqld]
> > > basedir=C:/mysql
> > > datadir=C:/mysql/data
> > > max_connections=750
> > > max_connect_errors=10000
> > >
> > > Whereas in ASP I always issued an "oRsRecordset.Close" command, I have
> > > replaced these with "mysql_free_result($resMessage2)", such as
follows:
> > > $sql = "SELECT username FROM users
> > > WHERE user_id = '" . $_SESSION["UserID"] . "'";
> > > $resUsers = mysql_query($sql) or die("Query failed [unable to locate
> > > user details]" . mysql_error());
> > > if (mysql_num_rows($resUsers) > 0) {
> > > $oRsUsers = mysql_fetch_assoc($resUsers);
> > > $strUserName = trim($oRsUsers["username"]);
> > > } else {
> > > $strUserName = "unknown";
> > > }
> > > mysql_free_result($resUsers);
> > >
> > > However, I have noticed that a handful of the mysql processes are
> > > sleeping with quite large millisecond "timeouts"(?)
> > > i.e. | 2727 | mbuser | MESSAGEBOARD:1701 | messageboard | Sleep |
766
> > > |.
> > > The state is showing as NULL on each of them though, but does this
> > > suggest I haven't freed them all up (although I've been through and
> > > checked quite a few times)?
> > >
> > > I've set the PHP session garbage collection at 5%. This is completely
> > > alien to me, so I don't know if it should go any higher? All session
> > > data is stored in one directory under c:\php\sessiondata\.
> > >
> > > The web log / event viewer isn't showing anything that I believe to be
> > > of significance.
> > >
> > > Many many thanks for your advice, it is greatly appreciated.
> > > Regards
> > > Gary
> > >
> > > "Sek-Mun Wong" <[EMAIL PROTECTED]> wrote in message
> > > news:<[EMAIL PROTECTED]>...
> > > > a 100% cpu process is pretty rude, I don't think that the network
> > > > bandwidth (even if it is only 10Mpbs) would cause your problem, so I
> > > > doubt that's it.
> > > >
> > > > Ok, check the following:
> > > >
> > > > 1) max connections setting in mysql (might be out of connections)
> > > > 2) check physical memory remaining (rogue process? see (4))
> > > > 3) are you using table locks? (deadlock issues?, if you have to
lock,
> > > > try not using pconnect for those transactions)
> > > > 4) do mysql_free_result when you're done with large queries (just in
> > > > case, I think php should do garbage collection properly)
> > > > 5) can you see the number of / what processes/queries are running
the
> > > > the mysql daemon?
> > > > 6) have you gone through your web logs to see if there's unusual
> > > > activity?
> > > >
> > > > You say the ASP version behaves, but obviously the code is doing
> > > > something different, funny because I assume that in asp you're using
> > > > odbc to connect to mysql? it *is* weird to get this problem in php
and
> > >
> > > > not asp.
> > > >
> > > > fwiw we run about a dozen virutal hosts, about 1500 page views per
day
> > >
> > > > each site, IIS, dual p3-933, 1Gb RAM, php4.3.2, mysql 4.0.12 and the
> > > > server hardly touches 10% at any time. It's all persistent
> > > > connections, and the mysql daemon is on the same box. Our sql is
> > > > intense, but streamlined.
> > > >
> > > > We also "pool" (it's not true persitent pooling, but per page
> > > > invocation) connections in our framework so a pconnect is done once
> > > > per framework call (ie, per page). But we religiously free_result
all
> > > > the time when we're done... haven't tried leaving this out so I
can't
> > > > tell if that's a real factor.
> > > >
> > > > That's probably the key, it's hard to tell without seeing how you
run
> > > > your sql or how the pages are designed.
> > > >
> > > >
> > > > "Gary Broughton" <[EMAIL PROTECTED]> wrote in message
> > > > news:[EMAIL PROTECTED]
> > > > > Hi guys
> > > > >
> > > > > Many thanks for your replies. I did originally use the CGI
version,
> > >
> > > > > but earlier today built a second machine, and clean installed IIS5
> > > > > and PHP 4.3.2 onto it, using the ISAPI module - and now connect to
> > > > > the remote MySQL database.
> > > > >
> > > > > Unfortunately, I'm getting pretty much the same 100% usage from
the
> > > > > mysqld-nt on the database server (although it occasionally drops
for
> > >
> > > > > a few seconds every minute or two). I've also tried mysqld-max-nt
> > > > > and mysqld-opt, but there is no difference.
> > > > >
> > > > > I use the 'mysql_pconnect()' option on my php pages, and indeed
the
> > > > > 'mysql.allow.persistent' is set to 'on'. I just don't get it,
> > > > > especially as the ASP version runs efficiently! Confused and
> > > > > frustrated!
> > > > >
> > > > > It's probably going to simply need another parameter or two
setting,
> > >
> > > > > but I'll be damned if I can find the answer!
> > > > >
> > > > > Any more suggestions would be more than welcome.
> > > > >
> > > > >
> > > > > "Sek-Mun Wong" <[EMAIL PROTECTED]> wrote in message
> > > > > news:<[EMAIL PROTECTED]>...
> > > > > > are you running php4isapi.dll (ISAPI) or php.exe (CGI) version?
> > > > > >
> > > > > > I know people recommend CGI, but post 4.2.3, the ISAPI version
is
> > > > > > very
> > > > >
> > > > > > stable and you'd be nuts to run a busy site in CGI mode.
> > > > > >
> > > > > > If you're running CGI, here is an explanation:
> > > > > > The most expensive operation is the *connection*, why mysql gets
> > > > > > flogged is because every time you close down a php script, it
dies
> > >
> > > > > > and
> > > > >
> > > > > > the connection dies, so a new one needs to be re-established. It
> > > > > > can take only 10-20 concurrent connections to kill the server.
> > > > > >
> > > > > > To "fix" this (it's more an infrastructure issue, really):
> > > > > >
> > > > > > 1) run ISAPI version of php
> > > > > > 2) under [MySql] in php.ini, make sure
> > > > > >
> > > > > > mysql.allow_persistent = On
> > > > > >
> > > > > > You'll be amazed at the difference.
> > > > > >
> > > > > >
> > > > > > "Gary Broughton" <[EMAIL PROTECTED]> wrote in message
> > > > > > news:[EMAIL PROTECTED]
> > > > > > > I wonder if anyone could offer any advice. We have a series
of
> > > > > > > message boards using a MySQL database running under ASP on
> > > > > > > Windows 2000 IIS 5
> > > > > > fine.
> > > > > > > Today I put the a PHP version live after it had been tested
over
> > >
> > > > > > > the
> > > > > > weekend
> > > > > > > with about 20 users. As soon as I enabled PHP on the live
> > > > > > > website
> > > > > > (separate
> > > > > > > to the test PHP already running), the CPU usage for MySQL-nt
> > > > > > > went up
> > > > >
> > > > > > > to
> > > > > > 100%
> > > > > > > constantly, making the site run at a crawl. After
uninstalling
> > > > > > > PHP and reverting to the ASP version for the live site, it all
> > > > > > > ran smoothly again. I have the Application set to Low (IIS
> > > > > > > Process) on both sites, the cgi.force_redirect is 0 as
required,
> > >
> > > > > > > and the machine
> > > > >
> > > > > > > is a dual 1.8G
> > > > > > Pentium
> > > > > > > with 512MB of memory (I know this could do with doubling, but
> > > > > > > why is
> > > > >
> > > > > > > it
> > > > > > okay
> > > > > > > running ASP code?). I've scoured the net looking for any
> > > > > > > suggestions, but without coming across anything concrete. Has
> > > > > > > anyone any ideas I could try out at all? Many thanks Gary
> > > > > > > Broughton
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
>
--- End Message ---
--- Begin Message ---
Check this out for a moment - this script takes a file name from a form
field (on the prior page) of the type file, which is used in HTML when you
want to be able to open a file browser from your page - hence the
$HTTP_POST_FILES as argument.
if (!is_uploaded_file($HTTP_POST_FILES['file']['tmp_name'])) {
echo "Error - file not uploaded";
@unlink($HTTP_POST_FILES['file']['tmp_name']);
} else {
if ($HTTP_POST_FILES['file']['size'] > $max_size_allowed) {
echo "Error - File was larger than the allowed maximum size";
@unlink($HTTP_POST_FILES['file']['tmp_name']);
} else {
if ($HTTP_POST_FILES['file']['type'] != "image/gif" AND
$HTTP_POST_FILES['file']['type'] != "image/pjpeg") {
echo "Error - only file types .gif and .jpg are allowed";
@unlink($HTTP_POST_FILES['file']['tmp_name']);
} else {
copy($HTTP_POST_FILES['file']['tmp_name'],"../some_dir_name/".$HTTP_POST_FIL
ES['file']['name']);
@unlink($HTTP_POST_FILES['file']['tmp_name']);
@chmod("../some_dir_name/".$HTTP_POST_FILES['file']['name'],
0777);
echo "The file " . $HTTP_POST_FILES['file']['name'] . " was
uploaded";
}
}
}
/Aidal
"Guest" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hii...
> How to delete file under windows with php, i found function unlink, but
this function run under linux, is there true that there are no function to
delete file in windows with php...??
>
> Is there any idea..???
>
> thanx
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
--- End Message ---
--- Begin Message ---
Oops - I forgot to add that this works on both Linux and Windows.
"Aidal" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Check this out for a moment - this script takes a file name from a form
> field (on the prior page) of the type file, which is used in HTML when you
> want to be able to open a file browser from your page - hence the
> $HTTP_POST_FILES as argument.
>
> if (!is_uploaded_file($HTTP_POST_FILES['file']['tmp_name'])) {
> echo "Error - file not uploaded";
> @unlink($HTTP_POST_FILES['file']['tmp_name']);
> } else {
> if ($HTTP_POST_FILES['file']['size'] > $max_size_allowed) {
> echo "Error - File was larger than the allowed maximum size";
> @unlink($HTTP_POST_FILES['file']['tmp_name']);
> } else {
> if ($HTTP_POST_FILES['file']['type'] != "image/gif" AND
> $HTTP_POST_FILES['file']['type'] != "image/pjpeg") {
> echo "Error - only file types .gif and .jpg are allowed";
> @unlink($HTTP_POST_FILES['file']['tmp_name']);
> } else {
>
>
copy($HTTP_POST_FILES['file']['tmp_name'],"../some_dir_name/".$HTTP_POST_FIL
> ES['file']['name']);
> @unlink($HTTP_POST_FILES['file']['tmp_name']);
>
@chmod("../some_dir_name/".$HTTP_POST_FILES['file']['name'],
> 0777);
> echo "The file " . $HTTP_POST_FILES['file']['name'] . "
was
> uploaded";
> }
> }
> }
>
> /Aidal
>
> "Guest" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hii...
> > How to delete file under windows with php, i found function unlink, but
> this function run under linux, is there true that there are no function to
> delete file in windows with php...??
> >
> > Is there any idea..???
> >
> > thanx
> >
> >
> > ---------------------------------
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site design software
>
>
--- End Message ---
--- Begin Message ---
Have you tried using chmod() on the files you create?
chmod(file_name, 0777) gives everyone all rights to the file.
"John Yu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It seems that when I try to unlink a file in php which has been created by
> php on a winxp machine I always get a unable to delete file, permission
> denied error...
>
> This seems to me to be very strange since the file was created by php and
> yet php doesn't have the rights to delete it.
>
> Anyone else ran into this and any suggestions at all?
>
> thanks in advance.
>
> John
>
>
--- End Message ---
--- Begin Message ---
I'm having some problems to config php on a win2003 Server. I'v e followed
all the instructions, but the browser can't parse php files.
Can anyone help me?
regards,
Sérgio
--- End Message ---
--- Begin Message ---
Hi
I would like to know if it's possible to have a PHP script that listens on a
specific port for incoming requests. If so, how would one go about doing
that?
If not, what language would be good to make that in on windows plateform?
thanks
John
--- End Message ---
--- Begin Message ---
> I would like to know if it's possible to have a PHP script that listens on a
> specific port for incoming requests. If so, how would one go about doing
> that?
>
> If not, what language would be good to make that in on windows plateform?
Would configure an apache server to listen on your desired port help you solve this
problem?
--- End Message ---
--- Begin Message ---
What version of PHP do you use ?
On PHP-4.1.0 there is an EXPERIMENTAL set of functions (so they say) -
socket_create, socket_bind, socket_listen, socket_accept - that combined
should do your trick...
Luis
----- Original Message -----
From: "John Yu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 06, 2003 2:49 PM
Subject: [PHP-WIN] Making a service with php
> Hi
>
> I would like to know if it's possible to have a PHP script that listens on
a
> specific port for incoming requests. If so, how would one go about doing
> that?
>
> If not, what language would be good to make that in on windows plateform?
>
> thanks
>
> John
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
4.3.2 Those functions aren't available on 4.3.2?
----- Original Message -----
From: "Luis Moreira" <[EMAIL PROTECTED]>
To: "John Yu" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, August 06, 2003 10:20 AM
Subject: Re: [PHP-WIN] Making a service with php
> What version of PHP do you use ?
> On PHP-4.1.0 there is an EXPERIMENTAL set of functions (so they say) -
> socket_create, socket_bind, socket_listen, socket_accept - that combined
> should do your trick...
>
> Luis
>
> ----- Original Message -----
> From: "John Yu" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, August 06, 2003 2:49 PM
> Subject: [PHP-WIN] Making a service with php
>
>
> > Hi
> >
> > I would like to know if it's possible to have a PHP script that listens
on
> a
> > specific port for incoming requests. If so, how would one go about doing
> > that?
> >
> > If not, what language would be good to make that in on windows
plateform?
> >
> > thanks
> >
> > John
> >
> >
> >
> > --
> > 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 ---
The documentation says "PHP 4 >= 4.1.0" so I expect they do...
I haven't use them though.
Luis
----- Original Message -----
From: "John Yu" <[EMAIL PROTECTED]>
To: "Luis Moreira" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, August 06, 2003 4:04 PM
Subject: Re: [PHP-WIN] Making a service with php
> 4.3.2 Those functions aren't available on 4.3.2?
> ----- Original Message -----
> From: "Luis Moreira" <[EMAIL PROTECTED]>
> To: "John Yu" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Wednesday, August 06, 2003 10:20 AM
> Subject: Re: [PHP-WIN] Making a service with php
>
>
> > What version of PHP do you use ?
> > On PHP-4.1.0 there is an EXPERIMENTAL set of functions (so they say) -
> > socket_create, socket_bind, socket_listen, socket_accept - that combined
> > should do your trick...
> >
> > Luis
> >
> > ----- Original Message -----
> > From: "John Yu" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, August 06, 2003 2:49 PM
> > Subject: [PHP-WIN] Making a service with php
> >
> >
> > > Hi
> > >
> > > I would like to know if it's possible to have a PHP script that
listens
> on
> > a
> > > specific port for incoming requests. If so, how would one go about
doing
> > > that?
> > >
> > > If not, what language would be good to make that in on windows
> plateform?
> > >
> > > thanks
> > >
> > > John
> > >
> > >
> > >
> > > --
> > > 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 ---
Actually
I've found a good class to use for this.
http://www.php-tools.de
The patServer is very useful. It has class already setup to handle a
multi-thread server. Although, I wouldn't mind some help with the client
though.
For example.
Client ===> (request) ===> Server
Client <=== (response) === Server
That's the standard model. How does the client capture this response?
Basically, for what I want to do, the server and client has to do a lot of
handshaking and data transferring. Obviously, the data transferred are
encrypted (base64 with a lot of string shifts, not md5 because I need the
original data).
Here's the thing. The client doesn't just send data, it needs to receive
too. So in this case, does the client have to function like a server too?
Open the port, send data but also stay and listen on the port?
Here's a basic model of 1 scenario:
Client ==== (req: Auth : ClientID) ===> Server
Client <==== (ans: True) ===== Server
Client ==== (req: Status) =====> Server
Client <=== (ans: uptime || connect_user || data_type) === Server
Client ==== (req: disconnect) ====> Server
Client ==== \\ ===> Server
That's a basic model, since there are maybe 10 other requests the server and
client have to handle.
any help is greatly needed!
thanks
John
----- Original Message -----
From: "Sven Schnitzke" <[EMAIL PROTECTED]>
To: "'John Yu'" <[EMAIL PROTECTED]>
Sent: Wednesday, August 06, 2003 4:26 PM
Subject: AW: [PHP-WIN] Making a service with php
> I did some experimenting with socket handling in
> PHP, modifying the socket server example of the
> manual.
>
> Basically it works, but from version to version there are
> different issues, mainly concerning the behaviour with
> connections going down the hard way. IMO the best
> version up to now has been 4.3.1 with quite flawless
> functionality.
>
> If you are interested I can send a basic command line
> script to you containing the necessary steps to put up
> a multi connection server.
> --
> Sven
>
> > -----Ursprüngliche Nachricht-----
> > Von: John Yu [SMTP:[EMAIL PROTECTED]
> > Gesendet am: Mittwoch, 6. August 2003 15:50
> > An: [EMAIL PROTECTED]
> > Betreff: [PHP-WIN] Making a service with php
> >
> > Hi
> >
> > I would like to know if it's possible to have a PHP script that listens
on a
> > specific port for incoming requests. If so, how would one go about doing
> > that?
> >
> > If not, what language would be good to make that in on windows
plateform?
> >
> > thanks
> >
> > John
> >
> >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
--- End Message ---