php-windows Digest 7 Aug 2003 16:58:49 -0000 Issue 1858

Topics (messages 21052 through 21062):

Resource Sharing or Resource Scheduling ??
        21052 by: Raheel Hussain
        21060 by: Miha Nedok
        21061 by: Raheel Hussain

HTTP Authentication using PHP & MySQL
        21053 by: tashfoo

Re: unable to delete php created files in php
        21054 by: Aidal

Can't Pass variable to other page
        21055 by: Jack
        21056 by: Ben
        21059 by: Miha Nedok

Re: PHP 4.3.2, Windows 2000 IIS 5, MySQL 4.013 CPU usage problem
        21057 by: Gary Broughton

Re: Making a service with php
        21058 by: Svensson, B.A.T. (HKG)

Main Directory and E_mail Extractor
        21062 by: Michael Bao

Administrivia:

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

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

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


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

i've made an application , which serves more than 35 cuncurrent users at a time,
now wht i m doing on the page where the data is being submitted is :

run a loop which iterates through all the submitted data of $_REQUEST
and i make a query and update that to the Access Database, on every rep of that loop.

the loop iterates five times, now ..............

if 35 users submit at the same time, 
the loop will run five time each for each of the user i.e 35 x 5.

here my application crashes and every person ( user ) is redirected to the login page, 
and all the data is lost in-between the application run.

note : no error is raised by the script or server.

any comments, on how can i do resource sharing or connection sharing etc. to avoid 
that????


regards
raheel











---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

--- End Message ---
--- Begin Message ---
An alternative could be switching to a SQL server ( MS SQL ) or the free
MySQL (which performes on unix-like systems better ).
I avoid using Access databases because of problems like you described.

-Mike

On Wed, 6 Aug 2003, Raheel Hussain wrote:

> Date: Wed, 6 Aug 2003 23:16:58 -0700 (PDT)
> From: Raheel Hussain <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Resource Sharing or Resource Scheduling ??
>
> hi all,
>
> i've made an application , which serves more than 35 cuncurrent users at a time,
> now wht i m doing on the page where the data is being submitted is :
>
> run a loop which iterates through all the submitted data of $_REQUEST
> and i make a query and update that to the Access Database, on every rep of that loop.
>
> the loop iterates five times, now ..............
>
> if 35 users submit at the same time,
> the loop will run five time each for each of the user i.e 35 x 5.
>
> here my application crashes and every person ( user ) is redirected to the login 
> page, and all the data is lost in-between the application run.
>
> note : no error is raised by the script or server.
>
> any comments, on how can i do resource sharing or connection sharing etc. to avoid 
> that????
>
>
> regards
> raheel
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software

--- End Message ---
--- Begin Message ---
hi again
well Yes, i m gonna do that, but the question remains there wht  if i do resource 
sharing means that if i want to block the connection sharing like what is being done 
in Java or other applications 
called connection pooling,
so how can it be done in PHP, just like java uses sleep() function , so is there any 
technique present in PHP???? 


Miha Nedok <[EMAIL PROTECTED]> wrote:
An alternative could be switching to a SQL server ( MS SQL ) or the free
MySQL (which performes on unix-like systems better ).
I avoid using Access databases because of problems like you described.

-Mike

On Wed, 6 Aug 2003, Raheel Hussain wrote:

> Date: Wed, 6 Aug 2003 23:16:58 -0700 (PDT)
> From: Raheel Hussain 
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Resource Sharing or Resource Scheduling ??
>
> hi all,
>
> i've made an application , which serves more than 35 cuncurrent users at a time,
> now wht i m doing on the page where the data is being submitted is :
>
> run a loop which iterates through all the submitted data of $_REQUEST
> and i make a query and update that to the Access Database, on every rep of that loop.
>
> the loop iterates five times, now ..............
>
> if 35 users submit at the same time,
> the loop will run five time each for each of the user i.e 35 x 5.
>
> here my application crashes and every person ( user ) is redirected to the login 
> page, and all the data is lost in-between the application run.
>
> note : no error is raised by the script or server.
>
> any comments, on how can i do resource sharing or connection sharing etc. to avoid 
> that????
>
>
> regards
> raheel
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

--- End Message ---
--- Begin Message ---

I’m kind of new to PHP, and I need help trying to figure out why my HTTP authentication scrip isn’t working correctly.

 

All scripts including the db dump are included.

 

I am running a Linux box with Apache Apache/1.3.27 & PHP PHP/4.3.1 with PHP installed as a module. In IE when I navigate to index.php I am prompted with a login dialog box however when I enter in a username and password that I have validated are in the MySQL database I am prompted with the box again. I am never given access to the page.

 

Is there something I am missing, or something I should configure in my httpd.conf file to get this to work? Your help is greatly appreciated.

 

Regards

 

Tashfoo


--- End Message ---
--- Begin Message ---
http://dk2.php.net/manual/en/function.chmod.php

"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 ---
Dear all
I had write a script like this :

$link = "page.php?day=$day&month=$month&year=$year";

when i click on the link, it should pass the parameter to "page.php" with
$month and $year variables.
It actually works fine in php4.2.1, but when i went to other office which
got php5.0 above installed, using the same script, but it won't pass any
parameters to page.php! How come?

I heard there is something to set in the php5.0's php.ini before i can do
so, is that right?

Please could anyone give me a hand on this?

Thx alot

Jack



--- End Message ---
--- Begin Message ---
I had the same problem a couple of weeks ago.

register_globals=On
magic_quotes_runtime=Off

Ben


"Jack" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Dear all
> I had write a script like this :
>
> $link = "page.php?day=$day&month=$month&year=$year";
>
> when i click on the link, it should pass the parameter to "page.php" with
> $month and $year variables.
> It actually works fine in php4.2.1, but when i went to other office which
> got php5.0 above installed, using the same script, but it won't pass any
> parameters to page.php! How come?
>
> I heard there is something to set in the php5.0's php.ini before i can do
> so, is that right?
>
> Please could anyone give me a hand on this?
>
> Thx alot
>
> Jack
>
>



--- End Message ---
--- Begin Message ---

Or access you variables via $_GET.

$varname = $_GET['varname'];

-Mike


On Thu, 7 Aug 2003, Ben wrote:

> Date: Thu, 7 Aug 2003 10:25:57 +0100
> From: Ben <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED], [EMAIL PROTECTED]
> Subject: [PHP-WIN] Re: Can't Pass variable to other page
>
> I had the same problem a couple of weeks ago.
>
> register_globals=On
> magic_quotes_runtime=Off
>
> Ben
>
>
> "Jack" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Dear all
> > I had write a script like this :
> >
> > $link = "page.php?day=$day&month=$month&year=$year";
> >
> > when i click on the link, it should pass the parameter to "page.php" with
> > $month and $year variables.
> > It actually works fine in php4.2.1, but when i went to other office which
> > got php5.0 above installed, using the same script, but it won't pass any
> > parameters to page.php! How come?
> >
> > I heard there is something to set in the php5.0's php.ini before i can do
> > so, is that right?
> >
> > Please could anyone give me a hand on this?
> >
> > Thx alot
> >
> > Jack
> >
> >
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
I've read up on this 'wait_timeout' and 'interactive_timeout' and brought it
right down to 300 seconds.  While I now have less big sleep timeouts (may be
coincidence) there are still a handful that currently up to around 700, and
increasing!  Is there any way possible of establishing what these users have
done on the webpage (even a URL would be handy, as I could then at least see
what course of action they selected)?  Somehow I guess it isn't possible?!

Following this, the mysqld process still regularly hogged the CPU, and was
up at 100% most of the time.  I then set the following in the ini file
set-variable=key_buffer=512K
set-variable=max_allowed_packet=1M
set-variable=table_cache=256
set-variable=sort_buffer=100k
set-variable=read_buffer_size=100k
set-variable=record_buffer=1M
set-variable=myisam_sort_buffer_size=64M
set-variable=thread_cache=8
... which was suggested in the documentation for lots of connections, but
again no noticeable difference.

I stopped and restarted the service a few times, and the CPU usage always
went straight back up to 100% by the time say a dozen users were connecting
again.  I am now going to try the query_cache_size setting you mentioned,
and will see if that helps the situation.

I have installed MySQL 4014 on the machine which is currently running the
website, and intend to copy the database from the other machine over to it
once this problem goes away :-)  I'm with you in that I don't think it's
going to have much bearing on things though.

With many thanks again for your time and help
Gary

"Sek-Mun Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> (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 ---
Then you might want to open a socket with php, and I think php
is able to do this. Check out http://www.php.net/socket, but
also socket_bind in particular.

        //Anders

> -----Original Message-----
> From: John Yu [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 06, 2003 4:17 PM
> To: Svensson, B.A.T. (HKG)
> Subject: Re: [PHP-WIN] Making a service with php
> 
> 
> No. It doesn't run on a web, it runs via commandline. The server script have
> to execute logical operations.
> 
> ----- Original Message -----
> From: "Svensson, B.A.T. (HKG)" <[EMAIL PROTECTED]>
> To: "John Yu" <[EMAIL PROTECTED]>
> Sent: Wednesday, August 06, 2003 10:01 AM
> Subject: RE: [PHP-WIN] Making a service with php
> 
> 
> > Would then a URL redirect to the port help you?
> >
> > > -----Original Message-----
> > > From: John Yu [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, August 06, 2003 4:00 PM
> > > To: Svensson, B.A.T. (HKG)
> > > Subject: Re: [PHP-WIN] Making a service with php
> > >
> > >
> > > Not really. I'm attempting to write a customized server and client
> package.
> > > The server basically give the client packages of data, client works on
> the
> > > data and send it back to the server. It's the same principle as
> [EMAIL PROTECTED]
> > > pseudo-parrellar processing
> > >
> > > John
> > > ----- Original Message -----
> > > From: "Svensson, B.A.T. (HKG)" <[EMAIL PROTECTED]>
> > > To: "Php Win32 list" <[EMAIL PROTECTED]>
> > > Sent: Wednesday, August 06, 2003 9:50 AM
> > > Subject: RE: [PHP-WIN] Making a service with php
> > >
> > >
> > > > > 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?
> > > >
> > > > --
> > > > PHP Windows Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> 

--- End Message ---
--- Begin Message ---
 
require ("d:/iis/www3/lib/common/auth.inc"); 

require ("/lib/common/auth.inc"); I need.

 

When I want to include some file, I must key in the absolute directory. So I change 
include_path line to "include_path = d:/iis/www3/" in "php.ini" file. But it doesn't 
work.Please tell me the reason.

 

When some clients visited my web site, I want to keep their E_mail address in my 
database. Please tell where I can get this kind of skills and materials. 

 

thank you,

 

Michael

 


--- End Message ---

Reply via email to