php-windows Digest 26 Apr 2002 05:21:08 -0000 Issue 1112

Topics (messages 13304 through 13324):

Re: Excel not closing after using it via COM
        13304 by: Neil Lincoln
        13305 by: Scott Hurring

Single threading a database call
        13306 by: Matt Babineau
        13311 by: Vail, Warren

Re: making a DB counter
        13307 by: Matt Babineau
        13308 by: Scott Hurring
        13310 by: Matt Babineau

Re: File upload issue 4.2.0
        13309 by: Ethan Nelson

command line options to php.exe
        13312 by: Peter Witkop

MySQL / PHP - possible to run many sql statements in the same execution?
        13313 by: Matt Babineau
        13314 by: Scott Hurring
        13315 by: Matt Babineau
        13321 by: Mike Flynn

Anoter explaination of my problem
        13316 by: Matt Babineau
        13322 by: Mike Flynn

Security Alert!-cgi.force_redirect=0
        13317 by: Matthew Gotth-Olsen
        13320 by: Webmaster

PHP Graphing engine
        13318 by: Matt Babineau
        13319 by: Webmaster

Re: the database locking
        13323 by: Matt Babineau

Re: Getting Apache 2.0.35 and PHP 4.2 to work on Win2k
        13324 by: Chris Dion

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 ---
On our systems the EXCEL COM object executes as a member of "SYSTEM" instead
of as a child of the owner of the Apache/php server. When the COM object
completes it leaves the EXCEL hanging around as a child of a SYSTEM process.

-----Original Message-----
From: Scott Hurring [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 25, 2002 11:59 AM
To: Php-Win (E-mail)
Subject: RE: [PHP-WIN] Excel not closing after using it via COM

I went back and ran some perl code using the
Excel COM object.  Excel does properly exit...
so it looks like you are correct -- it's
probably a bug in PHP's COM code.

Attached is is sample Perl, PHP and Excel,
if anyone wants to verify that excel does
indeed die after the perl script is finished,
yet stays alive when the PHP script is
finished.

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -----Original Message-----
>    Try
>
>     $book->Close("False");
>

Doesnt do anything.

>    But then one has to ask, why does it work fine from other
> languages, e.g. Perl? If the API were broken, it would seem
> that it would be broken regardless of the language one was
> using.
>
>      Scott

Yeah.. that's the way it seems now.


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002


--- End Message ---
--- Begin Message ---
I'm not doing this through Apache.

I tried out Win32 command line PHP and Perl.

So even though it might be an issue with Excel being 
owned by "SYSTEM" when run thru Apache, PHP still leaves
it open whereas Perl does not.

(And to boot, my Apache service is configured to 
 RunAs my account "scott", so it shouldn't be plauged
 by the "SYSTEM" ownership issue... even though
 i haven't tested it)

Please check out: http://furt.com/code/php/com_issues/
(Read 'readme.txt') 

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -----Original Message-----
> From: Neil Lincoln [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 1:20 PM
> To: Scott Hurring; Php-Win (E-mail)
> Subject: RE: [PHP-WIN] Excel not closing after using it via COM
> 
> 
> On our systems the EXCEL COM object executes as a member of 
> "SYSTEM" instead
> of as a child of the owner of the Apache/php server. When the 
> COM object
> completes it leaves the EXCEL hanging around as a child of a 
> SYSTEM process.
> 
> -----Original Message-----
> From: Scott Hurring [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 11:59 AM
> To: Php-Win (E-mail)
> Subject: RE: [PHP-WIN] Excel not closing after using it via COM
> 
> I went back and ran some perl code using the
> Excel COM object.  Excel does properly exit...
> so it looks like you are correct -- it's
> probably a bug in PHP's COM code.
> 
> Attached is is sample Perl, PHP and Excel,
> if anyone wants to verify that excel does
> indeed die after the perl script is finished,
> yet stays alive when the PHP script is
> finished.
> 
> ---
> Scott Hurring
> Systems Programmer
> EAC Corporation
> [EMAIL PROTECTED]
> Voice: 201-462-2149
> Fax: 201-288-1515
> 
> > -----Original Message-----
> >    Try
> >
> >     $book->Close("False");
> >
> 
> Doesnt do anything.
> 
> >    But then one has to ask, why does it work fine from other
> > languages, e.g. Perl? If the API were broken, it would seem
> > that it would be broken regardless of the language one was
> > using.
> >
> >      Scott
> 
> Yeah.. that's the way it seems now.
> 
> 
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> 
> 
--- End Message ---
--- Begin Message ---
I am making a call to a database to update a record incrementing the
number in the field. When I put some load on this page, I get it
returning the same number sometimes. This is unacceptable. because under
heavier load people will be receiving the same number and it will not
count the correct amount of page views. Is there any type of locking I
can use to make sure that the operation is single threaded?
 
Matt Babineau
Freelance Internet Developer
e:  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED] 
p: 603.943.4237
w:  <http://www.illuminatistudios.com/> http://www.illuminatistudios.com
 
 
--- End Message ---
--- Begin Message ---
Because you didn't say, I have to assume you are using MySQL as your
database.  

It is my understanding that an Auto Increment of a primary key field is
single threaded, such that if you do an insert, followed by mysql_insert_id
() to get the number inserted.  

Anything else, that I can think of, will cause you to have to do locks in
some way.

Please let me know if you have found this to not be true.

Warren Vail
Tools, Metrics & Quality Processes
(415) 667-7814
Pager (877) 774-9891
215 Fremont 02-658


-----Original Message-----
From: Matt Babineau [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 25, 2002 10:59 AM
To: 'Php-Win (E-mail)'
Subject: [PHP-WIN] Single threading a database call


I am making a call to a database to update a record incrementing the
number in the field. When I put some load on this page, I get it
returning the same number sometimes. This is unacceptable. because under
heavier load people will be receiving the same number and it will not
count the correct amount of page views. Is there any type of locking I
can use to make sure that the operation is single threaded?
 
Matt Babineau
Freelance Internet Developer
e:  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED] 
p: 603.943.4237
w:  <http://www.illuminatistudios.com/> http://www.illuminatistudios.com
 
 
--- End Message ---
--- Begin Message ---
Here is a snip of my code
 
$query = "SELECT Count FROM COUNTER_Page_Views WHERE Counter_ID = '" .
$count_id . "' FOR UPDATE";
$query1 = "UPDATE COUNTER_Page_Views SET Count = Count + 1 WHERE
Counter_ID = '" . $count_id . "'";
$result = mysql_query($query);
$result1 = mysql_query($query1);
 
what is happeneing is that seesion are colliding in between these
queries, I need to somehow single thread this section of code. Is that
possible? MySQL says that you can lock rows for updating but it only
seems to work when the queries are in the same code block, not when
executed separately. Anyone have a solution to making an update to a
record without having other users make an update in the middle of a
different users' process?
 
Matt Babineau
Freelance Internet Developer
e:  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED] 
p: 603.943.4237
w:  <http://www.illuminatistudios.com/> http://www.illuminatistudios.com
 
 
--- End Message ---
--- Begin Message ---
Try this:
http://www.mysql.com/doc/L/O/LOCK_TABLES.html

That seems to be what you're asking for...
to lock down the table while you select, 
then update... 

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -----Original Message-----
> From: Matt Babineau [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 2:41 PM
> To: 'Php-Win (E-mail)'
> Subject: [PHP-WIN] re: making a DB counter
> 
> 
> Here is a snip of my code
>  
> $query = "SELECT Count FROM COUNTER_Page_Views WHERE Counter_ID = '" .
> $count_id . "' FOR UPDATE";
> $query1 = "UPDATE COUNTER_Page_Views SET Count = Count + 1 WHERE
> Counter_ID = '" . $count_id . "'";
> $result = mysql_query($query);
> $result1 = mysql_query($query1);
>  
> what is happeneing is that seesion are colliding in between these
> queries, I need to somehow single thread this section of code. Is that
> possible? MySQL says that you can lock rows for updating but it only
> seems to work when the queries are in the same code block, not when
> executed separately. Anyone have a solution to making an update to a
> record without having other users make an update in the middle of a
> different users' process?
>  
> Matt Babineau
> Freelance Internet Developer
> e:  <mailto:[EMAIL PROTECTED]>
> [EMAIL PROTECTED] 
> p: 603.943.4237
> w:  <http://www.illuminatistudios.com/> 
http://www.illuminatistudios.com
 
 
--- End Message ---
--- Begin Message ---
Thanks Scott I think this will help, will let you know how it comes out.

Matt Babineau
Freelance Internet Developer
e: [EMAIL PROTECTED] 
p: 603.943.4237
w: http://www.illuminatistudios.com
 


-----Original Message-----
From: Scott Hurring [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, April 25, 2002 2:52 PM
To: Php-Win (E-mail)
Subject: RE: [PHP-WIN] re: making a DB counter


Try this:
http://www.mysql.com/doc/L/O/LOCK_TABLES.html

That seems to be what you're asking for...
to lock down the table while you select, 
then update... 

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -----Original Message-----
> From: Matt Babineau [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 2:41 PM
> To: 'Php-Win (E-mail)'
> Subject: [PHP-WIN] re: making a DB counter
> 
> 
> Here is a snip of my code
>  
> $query = "SELECT Count FROM COUNTER_Page_Views WHERE Counter_ID = '" .

> $count_id . "' FOR UPDATE"; $query1 = "UPDATE COUNTER_Page_Views SET 
> Count = Count + 1 WHERE Counter_ID = '" . $count_id . "'";
> $result = mysql_query($query);
> $result1 = mysql_query($query1);
>  
> what is happeneing is that seesion are colliding in between these 
> queries, I need to somehow single thread this section of code. Is that

> possible? MySQL says that you can lock rows for updating but it only 
> seems to work when the queries are in the same code block, not when 
> executed separately. Anyone have a solution to making an update to a 
> record without having other users make an update in the middle of a 
> different users' process?
>  
> Matt Babineau
> Freelance Internet Developer
> e:  <mailto:[EMAIL PROTECTED]>
> [EMAIL PROTECTED]
> p: 603.943.4237
> w:  <http://www.illuminatistudios.com/> 
http://www.illuminatistudios.com
 
 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
If you will notice, the error happens on line 0.  That happens before PHP
hits my scripts, so the error here is a processing error in PHP... not the
result of a command I run.  I could post to an empty file and PHP would
still kick out this error if I didn't specify anything in the <input
type=file name=thename> tag on the previous form.

-Ethan

-----Original Message-----
From: Dash McElroy
To: Ethan Nelson
Cc: '[EMAIL PROTECTED]'
Sent: 4/24/02 1:11 PM
Subject: RE: [PHP-WIN] File upload issue 4.2.0

You should probably check to see if the variable is set before you try
and
read the uploaded file...

-Dash

-----Original Message-----
From: Ethan Nelson [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, April 24, 2002 11:57 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP-WIN] File upload issue 4.2.0


I get this error when I submit a form with nothing specified in the file
upload field.  My understanding is that the server or PHP should submit
"none" by default when nothing is submitted as the value of the name
associated with the file upload field.
This doesn't appear to be sending anything at all?  Did something
change?
PHP Warning: No file uploaded in Unknown on line 0 PHP Warning: Unable
to
open '' for reading: Permission denied in
d:\inetpub\klcc\public_html\admin\broadcast\brodnotes.html on line 28 

Thanks,

-Ethan

___________________________________
Ethan Nelson, Systems Administrator
Net Solutions, LLC
840 Lawrence Street
Eugene, OR 97401
[EMAIL PROTECTED]
http://www.netsolutionsllc.com
Voice +1 541 345-7087
Fax   +1 541 485-5519


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I'm trying to pass command line options to php.exe under IIS 5 
(win2k), but without any success.  What's going on is that I've got 
two sites that need their own include_path's.  I've tried putting 
"C:\php\php.exe -d include_path='.;c:\foo' %s %s" and "C:\php\php.exe 
-c c:\foo %s %s" into the IIS configuration for each site, but 
neither has had any effect.  Is what I'm trying to do possible? 
Thanks very much for your time.

Peter Witkop
--- End Message ---
--- Begin Message ---
Let me try and explain a little better:
 
Here is some query code
 
$query3 = "LOCK TABLES COUNTER_PAGE_VIEWS";
$query = "SELECT Count FROM COUNTER_Page_Views WHERE Counter_ID = '" .
$count_id . "'";
$query1 = "UPDATE COUNTER_Page_Views SET Count = Count + 1 WHERE
Counter_ID = '" . $count_id . "'";
$result3 = mysql_query($query3);
$result1 = mysql_query($query1);
$result = mysql_query($query);
 
 
As the page processes, it processes in order, so it owuld go through
those lines of code and do what it needs to do. Currently two users can
cause a threading issue where even if I lock the table, because the call
is not coming from inside MySQL. So the locking only occurs for the
single Query which locks the Table, then the next query execution voids
the write lock on the table.
 
What I would need to do here is either lump all the queryioes into one
SQL execution or lock the PHP code so it is single threaded like this:
 
$query3 = "LOCK TABLES COUNTER_PAGE_VIEWS";
$query = "SELECT Count FROM COUNTER_Page_Views WHERE Counter_ID = '" .
$count_id . "'";
$query1 = "UPDATE COUNTER_Page_Views SET Count = Count + 1 WHERE
Counter_ID = '" . $count_id . "'";

<LOCK THE CODE SO ONLY ONE CLIENT CAN RUN AT A TIME>
$result3 = mysql_query($query3);
$result1 = mysql_query($query1);
$result = mysql_query($query);
<RELEASE THE LOCK>
 
Anyone have any suggestions?
 
Matt Babineau
Freelance Internet Developer
e:  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED] 
p: 603.943.4237
w:  <http://www.illuminatistudios.com/> http://www.illuminatistudios.com
 
 
--- End Message ---
--- Begin Message ---
Sorry for seeming a bit dense, but what's the problem
with using "LOCL TABLES" for all SQL stmnts?

It's my understanding that it will lock tables
and prevent other procs from reading/writing to
that table while you've got a lock on it.

Is that not the case?

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -----Original Message-----
> From: Matt Babineau [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 3:46 PM
> To: 'Php-Win (E-mail)'
> Subject: [PHP-WIN] MySQL / PHP - possible to run many sql 
> statements in
> the same execution?
> 
> 
> Let me try and explain a little better:
>  
> Here is some query code
>  
> $query3 = "LOCK TABLES COUNTER_PAGE_VIEWS";
> $query = "SELECT Count FROM COUNTER_Page_Views WHERE Counter_ID = '" .
> $count_id . "'";
> $query1 = "UPDATE COUNTER_Page_Views SET Count = Count + 1 WHERE
> Counter_ID = '" . $count_id . "'";
> $result3 = mysql_query($query3);
> $result1 = mysql_query($query1);
> $result = mysql_query($query);
>  
>  
> As the page processes, it processes in order, so it owuld go through
> those lines of code and do what it needs to do. Currently two 
> users can
> cause a threading issue where even if I lock the table, 
> because the call
> is not coming from inside MySQL. So the locking only occurs for the
> single Query which locks the Table, then the next query 
> execution voids
> the write lock on the table.
>  
> What I would need to do here is either lump all the queryioes into one
> SQL execution or lock the PHP code so it is single threaded like this:
>  
> $query3 = "LOCK TABLES COUNTER_PAGE_VIEWS";
> $query = "SELECT Count FROM COUNTER_Page_Views WHERE Counter_ID = '" .
> $count_id . "'";
> $query1 = "UPDATE COUNTER_Page_Views SET Count = Count + 1 WHERE
> Counter_ID = '" . $count_id . "'";
> 
> <LOCK THE CODE SO ONLY ONE CLIENT CAN RUN AT A TIME>
> $result3 = mysql_query($query3);
> $result1 = mysql_query($query1);
> $result = mysql_query($query);
> <RELEASE THE LOCK>
>  
> Anyone have any suggestions?
>  
> Matt Babineau
> Freelance Internet Developer
> e:  <mailto:[EMAIL PROTECTED]>
> [EMAIL PROTECTED] 
> p: 603.943.4237
> w:  <http://www.illuminatistudios.com/> 
http://www.illuminatistudios.com
 
 
--- End Message ---
--- Begin Message ---
Well, when I tested the code, It was still allowing 2 requests to
update/read the table at the same time. It may only be in the case tha
tI am facing when I am updating the table but also need to output the
new value that was updated. I may just be attacking this problem wrong
too.

Matt Babineau
Freelance Internet Developer
e: [EMAIL PROTECTED] 
p: 603.943.4237
w: http://www.illuminatistudios.com
 


-----Original Message-----
From: Scott Hurring [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, April 25, 2002 4:49 PM
To: Php-Win (E-mail)
Subject: RE: [PHP-WIN] MySQL / PHP - possible to run many sql statements
in the same execution?


Sorry for seeming a bit dense, but what's the problem
with using "LOCL TABLES" for all SQL stmnts?

It's my understanding that it will lock tables
and prevent other procs from reading/writing to
that table while you've got a lock on it.

Is that not the case?

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -----Original Message-----
> From: Matt Babineau [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 3:46 PM
> To: 'Php-Win (E-mail)'
> Subject: [PHP-WIN] MySQL / PHP - possible to run many sql
> statements in
> the same execution?
> 
> 
> Let me try and explain a little better:
>  
> Here is some query code
>  
> $query3 = "LOCK TABLES COUNTER_PAGE_VIEWS";
> $query = "SELECT Count FROM COUNTER_Page_Views WHERE Counter_ID = '" .

> $count_id . "'"; $query1 = "UPDATE COUNTER_Page_Views SET Count = 
> Count + 1 WHERE Counter_ID = '" . $count_id . "'";
> $result3 = mysql_query($query3);
> $result1 = mysql_query($query1);
> $result = mysql_query($query);
>  
>  
> As the page processes, it processes in order, so it owuld go through 
> those lines of code and do what it needs to do. Currently two users 
> can cause a threading issue where even if I lock the table,
> because the call
> is not coming from inside MySQL. So the locking only occurs for the
> single Query which locks the Table, then the next query 
> execution voids
> the write lock on the table.
>  
> What I would need to do here is either lump all the queryioes into one

> SQL execution or lock the PHP code so it is single threaded like this:
>  
> $query3 = "LOCK TABLES COUNTER_PAGE_VIEWS";
> $query = "SELECT Count FROM COUNTER_Page_Views WHERE Counter_ID = '" .

> $count_id . "'"; $query1 = "UPDATE COUNTER_Page_Views SET Count = 
> Count + 1 WHERE Counter_ID = '" . $count_id . "'";
> 
> <LOCK THE CODE SO ONLY ONE CLIENT CAN RUN AT A TIME>
> $result3 = mysql_query($query3);
> $result1 = mysql_query($query1);
> $result = mysql_query($query);
> <RELEASE THE LOCK>
>  
> Anyone have any suggestions?
>  
> Matt Babineau
> Freelance Internet Developer
> e:  <mailto:[EMAIL PROTECTED]>
> [EMAIL PROTECTED]
> p: 603.943.4237
> w:  <http://www.illuminatistudios.com/> 
http://www.illuminatistudios.com
 
 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Suggestions:

http://www.mysql.com/doc/L/o/Locking_Issues.html
http://www.mysql.com/doc/T/r/Transactional_Commands.html
VERY good: http://www.mysql.com/articles/ddws/61.html
http://www.phpbuilder.com/forum/read.php3?num=5&id=23671&loc=0&thread=23671


At 04:59 PM 4/25/02 -0400, you wrote:
>Well, when I tested the code, It was still allowing 2 requests to
>update/read the table at the same time. It may only be in the case tha
>tI am facing when I am updating the table but also need to output the
>new value that was updated. I may just be attacking this problem wrong
>too.
>
>Matt Babineau
>Freelance Internet Developer
>e: [EMAIL PROTECTED]
>p: 603.943.4237
>w: http://www.illuminatistudios.com
>
>
>
>-----Original Message-----
>From: Scott Hurring [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, April 25, 2002 4:49 PM
>To: Php-Win (E-mail)
>Subject: RE: [PHP-WIN] MySQL / PHP - possible to run many sql statements
>in the same execution?
>
>
>Sorry for seeming a bit dense, but what's the problem
>with using "LOCL TABLES" for all SQL stmnts?
>
>It's my understanding that it will lock tables
>and prevent other procs from reading/writing to
>that table while you've got a lock on it.
>
>Is that not the case?
>
>---
>Scott Hurring
>Systems Programmer
>EAC Corporation
>[EMAIL PROTECTED]
>Voice: 201-462-2149
>Fax: 201-288-1515
>
> > -----Original Message-----
> > From: Matt Babineau [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, April 25, 2002 3:46 PM
> > To: 'Php-Win (E-mail)'
> > Subject: [PHP-WIN] MySQL / PHP - possible to run many sql
> > statements in
> > the same execution?
> >
> >
> > Let me try and explain a little better:
> >
> > Here is some query code
> >
> > $query3 = "LOCK TABLES COUNTER_PAGE_VIEWS";
> > $query = "SELECT Count FROM COUNTER_Page_Views WHERE Counter_ID = '" .
>
> > $count_id . "'"; $query1 = "UPDATE COUNTER_Page_Views SET Count =
> > Count + 1 WHERE Counter_ID = '" . $count_id . "'";
> > $result3 = mysql_query($query3);
> > $result1 = mysql_query($query1);
> > $result = mysql_query($query);
> >
> >
> > As the page processes, it processes in order, so it owuld go through
> > those lines of code and do what it needs to do. Currently two users
> > can cause a threading issue where even if I lock the table,
> > because the call
> > is not coming from inside MySQL. So the locking only occurs for the
> > single Query which locks the Table, then the next query
> > execution voids
> > the write lock on the table.
> >
> > What I would need to do here is either lump all the queryioes into one
>
> > SQL execution or lock the PHP code so it is single threaded like this:
> >
> > $query3 = "LOCK TABLES COUNTER_PAGE_VIEWS";
> > $query = "SELECT Count FROM COUNTER_Page_Views WHERE Counter_ID = '" .
>
> > $count_id . "'"; $query1 = "UPDATE COUNTER_Page_Views SET Count =
> > Count + 1 WHERE Counter_ID = '" . $count_id . "'";
> >
> > <LOCK THE CODE SO ONLY ONE CLIENT CAN RUN AT A TIME>
> > $result3 = mysql_query($query3);
> > $result1 = mysql_query($query1);
> > $result = mysql_query($query);
> > <RELEASE THE LOCK>
> >
> > Anyone have any suggestions?
> >
> > Matt Babineau
> > Freelance Internet Developer
> > e:  <mailto:[EMAIL PROTECTED]>
> > [EMAIL PROTECTED]
> > p: 603.943.4237
> > w:  <http://www.illuminatistudios.com/>
>http://www.illuminatistudios.com
>
>
>
>--
>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


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

--- End Message ---
--- Begin Message ---
thread1 ----> updates and increments a numebr in the DB
thread2 ----> does the same thing as thread one
thread1 ----> reads the database to get the new value for display on the
web page
thread2 ----> also reads the database for the new updated value.
 
 
so thread1 displays "2" and thread2 displays "2" also because thread1
could not read the database value before thread2 updated the value.
 
Matt Babineau
Freelance Internet Developer
e:  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED] 
p: 603.943.4237
w:  <http://www.illuminatistudios.com/> http://www.illuminatistudios.com
 
 
--- End Message ---
--- Begin Message ---
Dude... if you use LOCK TABLE WRITE (not READ) on the table.. it will STAY 
locked.. until you give the UNLOCK command.  It completely solves any 
concurrency issues.  This is a fundamental database issue and MySQL is 
meant to handle it. :)

-Mike

At 05:19 PM 4/25/02 -0400, Matt Babineau wrote:
>thread1 ----> updates and increments a numebr in the DB
>thread2 ----> does the same thing as thread one
>thread1 ----> reads the database to get the new value for display on the
>web page
>thread2 ----> also reads the database for the new updated value.
>
>
>so thread1 displays "2" and thread2 displays "2" also because thread1
>could not read the database value before thread2 updated the value.
>
>Matt Babineau
>Freelance Internet Developer
>e:  <mailto:[EMAIL PROTECTED]>
>[EMAIL PROTECTED]
>p: 603.943.4237
>w:  <http://www.illuminatistudios.com/> http://www.illuminatistudios.com
>
>


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

--- End Message ---
--- Begin Message ---
I'm running IIS on a WinXP box, I've got everything installed, however
whenever I try to access a php script I get this error which I'm sure you
all are familiar with:

----------------------------------------------------------------------
Security Alert! PHP CGI cannot be accessed directly.
This PHP CGI binary was compiled with force-cgi-redirect enabled. This means
that a page will only be served up if the REDIRECT_STATUS CGI variable is
set. This variable is set, for example, by Apache's Action directive
redirect.

You may disable this restriction by recompiling the PHP binary with
the --disable-force-cgi-redirect switch. If you do this and you have your
PHP CGI binary accessible somewhere in your web tree, people will be able to
circumvent .htaccess security by loading files through the PHP parser. A
good way around this is to define doc_root in your php.ini file to something
other than your top-level DOCUMENT_ROOT. This way you can separate the part
of your web space which uses PHP from the normal part using .htaccess
security. If you do not have any .htaccess restrictions anywhere on your
site you can leave doc_root undefined. If you are running IIS, you may
safely set cgi.force_redirect=0 in
php.ini. -------------------------------------------------------------------
-------

So I reread through the documentation, and I made sure that
"cgi.force_redirect=0" under my php.ini under c:\windows\ is there something
I'm missing? I've tried the insteller and the manual install, and bothe give
me the same message... I've even tried removing php completely and
re-installing it both ways... no dice... an help would be appreciated...







--- End Message ---
--- Begin Message ---
You might need to have the second line in PHP.INI too:

cgi.force_redirect=0
cgi.redirect_status_env ENV_VAR_NAME


Cor van de Veen


"Matthew Gotth-Olsen" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm running IIS on a WinXP box, I've got everything installed, however
> whenever I try to access a php script I get this error which I'm sure you
> all are familiar with:
>
> ----------------------------------------------------------------------
> Security Alert! PHP CGI cannot be accessed directly.
> This PHP CGI binary was compiled with force-cgi-redirect enabled. This
means
> that a page will only be served up if the REDIRECT_STATUS CGI variable is
> set. This variable is set, for example, by Apache's Action directive
> redirect.
>
> You may disable this restriction by recompiling the PHP binary with
> the --disable-force-cgi-redirect switch. If you do this and you have your
> PHP CGI binary accessible somewhere in your web tree, people will be able
to
> circumvent .htaccess security by loading files through the PHP parser. A
> good way around this is to define doc_root in your php.ini file to
something
> other than your top-level DOCUMENT_ROOT. This way you can separate the
part
> of your web space which uses PHP from the normal part using .htaccess
> security. If you do not have any .htaccess restrictions anywhere on your
> site you can leave doc_root undefined. If you are running IIS, you may
> safely set cgi.force_redirect=0 in
>
php.ini. -------------------------------------------------------------------
> -------
>
> So I reread through the documentation, and I made sure that
> "cgi.force_redirect=0" under my php.ini under c:\windows\ is there
something
> I'm missing? I've tried the insteller and the manual install, and bothe
give
> me the same message... I've even tried removing php completely and
> re-installing it both ways... no dice... an help would be appreciated...
>
>
>
>
>
>
>


--- End Message ---
--- Begin Message ---
Does anyone know of any good graphing engines for PHP? I need a slick
way to represent some numerical data.
 
Matt Babineau
Freelance Internet Developer
e:  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED] 
p: 603.943.4237
w:  <http://www.illuminatistudios.com/> http://www.illuminatistudios.com
 
 
--- End Message ---
--- Begin Message ---
http://www.hotscripts.com/PHP/



-------------------------------------------------------
"Matt Babineau" <[EMAIL PROTECTED]> schreef in bericht
014d01c1ecb0$c7fc8960$0100a8c0@developerx">news:014d01c1ecb0$c7fc8960$0100a8c0@developerx...
> Does anyone know of any good graphing engines for PHP? I need a slick
> way to represent some numerical data.
>
> Matt Babineau
> Freelance Internet Developer
> e:  <mailto:[EMAIL PROTECTED]>
> [EMAIL PROTECTED]
> p: 603.943.4237
> w:  <http://www.illuminatistudios.com/> http://www.illuminatistudios.com
>
>
>


--- End Message ---
--- Begin Message ---
Here is the code that appears to work:
 
$result0 = mysql_query("LOCK TABLES COUNTER_Page_Views WRITE");
$result1 = mysql_query("UPDATE COUNTER_Page_Views SET Count = Count + 1
WHERE Counter_ID = '" . $count_id . "'");
$result2 = mysql_query("SELECT Count FROM COUNTER_Page_Views WHERE
Counter_ID = '" . $count_id . "'");
$result3 = mysql_query("UNLOCK TABLES;");
 
 
What I think I am running into is a wierd runtime thing between
javascript and the html on the page. I should be ok though, the lock
appears to work after reading over the MySQL stuff again.
 
Matt Babineau
Freelance Internet Developer
e:  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED] 
p: 603.943.4237
w:  <http://www.illuminatistudios.com/> http://www.illuminatistudios.com
 
 
--- End Message ---
--- Begin Message ---
David,
    Install PHP 4.2 like you usually would but in your httpd.conf put:

LoadModule php4_module C:\php\experimental\apache2filter.dll
AddType application/x-httpd-php .php

I did a complete uninstall and reinstall of both apache and php when I
upgraded so nothing would be confused.

--Chris

"David" <[EMAIL PROTECTED]> wrote in message
001501c1eb49$e440da80$6700a8c0@WOPR">news:001501c1eb49$e440da80$6700a8c0@WOPR...
> I've been running apache 2 as my server for a while, and have been
> running php as a cgi (I know not the best idea). I saw that 4.2 offered
> experimental support, so I tried upgrading to that. Install.txt only
> includes instructions for 1.3.x, but I tried adjusting it to 2.x I
> couldn't get them to work. I then  reverted to 4.1.2, but this had the
> following odd behavior: whenever I have a page request such as
> "file.php?foo=bar" it would never acknowledge it (load the page as
> though foo=bar wasn't there." I haven't had this problem before. I then
> tried running 4.2 as a cgi. It causes a message "The procedure entry
> point php_output_activate could not be located in the dynamic link
> library php4ts.dll" to pop up. Any help with apache 2 and php 4.2 would
> be a great help.
>
> David Tucci
>
>


--- End Message ---

Reply via email to