[PHP] April fools day - did anyone notice Thies's fangs on rc1???

2002-04-02 Thread Frank Joerdens

Did anyone else notice Thies's fangs on the phpinfo() page of 4.2.0rc1
yesterday? I wonder what they where . . . french fries? Salty sticks
(German 'Salzstangen')?? At first I though I was hallucinating,
especially when I found that he was gone again today! Try setting your
server's system date back to yesterday, as in

$ date -s 04/01/02

:))

- Frank

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




[PHP] microtime.c build problem mentioned in FAQ

2002-02-28 Thread Frank Joerdens

I've got the microtimec build problem mentioned in the FAQ with PHP
412 on Redhat 61:

[root@superfly /root]# uname -a
Linux superfly 2413 #1 SMP Sun Nov 25 18:39:15 CET 2001 i686 unknown

[root@superfly /root]# ldd --version
ldd (GNU libc) 212

And my symlinks form the kerneldir to /usr/include are OK Running the
test mentioned in the FAQ gives warnings but no errors:

[root@superfly php-412]# gcc -E testc /dev/null
In file included from /usr/include/sys/resourceh:25,
 from testc:1:
/usr/include/bits/resourceh:109: warning: `RLIM_INFINITY' redefined
/usr/include/asm/resourceh:26: warning: this is the location of the
previous definition

The workaround described by Lukas on 23-Jan-2002 06:49 works for me too,
ie commenting out

#ifdef HAVE_SYS_RESOURCE_H (and the corresponding #endif)

in microtimec to make sure that sys/resourceh gets included

My question is: Is this a bug or am I screwing something up by
commenting out those 2 lines?

Regards, Frank 

-- 
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




Re: [PHP] Re: Where To Find Resources About Programming Style (my bleedin' code is so darn ugly)

2002-02-19 Thread Frank Joerdens

On Sun, Feb 17, 2002 at 08:05:17PM +0100, Christian Blichmann wrote:
[ . . . ]
 P.S.: Your code _always_ works? -Wow...

I was trying to say that I usually get things to work at the end of the
day, when I have enough time to tweak the code, but that my code at some
point tends to become unreadable which is not a functionality issue but
more of a managament question (reinventing everything that I'd figured
out at some point over and over again begins to feel kinda silly) . . .

Thanks for your suggestions!

Regards, Frank

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




Re: [PHP] Re: Where To Find Resources About Programming Style (my bleedin' code is so darn ugly)

2002-02-19 Thread Frank Joerdens

On Sun, Feb 17, 2002 at 12:39:49PM -0800, Lars Torben Wilson wrote:
[ . . . ]
 An excellent book on coding practices is 'Code Complete', by Steve C
 McConnell.
  
 
http://www.amazon.com/exec/obidos/ASIN/1556154844/qid=1013978113/sr=8-1/ref=sr_8_67_1/102-2030399-6728144
 
 There is also the Indian Hill style guide--for C, but highly 
 transferrable to PHP:
 
 http://dogbert.comsc.ucok.edu/~mccann/cstyle.html
 
 For a whole list of 'em, check out:
 
 http://www.cs.umd.edu/users/cml/cstyle/

I'll check 'em out!

Thanks all,

Frank

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




[PHP] Where To Find Resources About Programming Style (my bleedin' code is so darn ugly)

2002-02-16 Thread Frank Joerdens

I am looking for a good manual or introduction on how to write readable,
extensible code (in any programming language). To give you an example,
this bit looks pretty darn horrible and I just don't know how to
rephrase it to make it more concise and readable:

- snip -
if ( ($var0)  ( (strlen($var)==strlen(intval($var))) or 
((strlen($var)-1)==strlen(intval($var))) ) ) {

do stuff;

}
- snap -

(actually, depending on how you've configured your mail reader, or how
your terminal is set, this boolean expression may acually not appear in
one line . . . which is a problem in itself)

I am not sure why, but one problem that I happen to run up against is
that I write expressions (boolean) which get very long and because you
can't split them (what with them being conditionals in if clauses) - or
can you? - they stretch off the screen which makes my code pretty much
unreadable (I noticed that good-looking code tends to stick with, like,
70 or something characters in width).

But that's just one problem.

The stuff that I do always works, but I always have difficulties
understanding it once I come back to it after a while (the fact that I
am also lazy at commenting is not the issue - it is my belief that
well-written code should be readable as well as functional).

There must be some kind of canonical text on the subject matter, just as
there are canonical texts on SQL (Codd, Celko), C (Kernigan, Ritchie),
Perl (Wall), epistemology (Kant), the laws of motion (Newton), general
relativity (Einstein), psychoanlysis (Freud) . . . you name it.

Regards, Frank

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




[PHP] SAPI (Apache 2) question connection pooling

2002-02-01 Thread Frank Joerdens

Greetings. I am wondering about the status of the multithreaded PHP for
the multithreaded Apache. In particular, I'd like to know
 
a) if Apache 2 is a single-process server (as opposed to Apache 1.x which
forks a new process for a new request)

b) if PHP will work, or does work, with Apache 2 in this mode

c) how database connection pooling will work with a single http/php
multithreaded server process

d) if maybe integrating php with a servlet engine as described in

http://www.php.net/manual/en/ref.java.php

allows you to use connection pooling via jdbc or something . . . ?

I am asking because connection pooling as it works now with persistent
connections is pretty awkward, and leads me to look with envy on the
Aolserver/TCL crowd . . . (I like PHP and see no reason to switch to TCL
except for the connection pooling issue).

Regards, Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] SAPI (Apache 2) question connection pooling

2002-02-01 Thread Frank Joerdens

On Fri, Feb 01, 2002 at 09:14:24AM -0800, Rasmus Lerdorf wrote:
  a) if Apache 2 is a single-process server (as opposed to Apache 1.x which
  forks a new process for a new request)
 
 It is a hybrid server which can be anything from one to the other.
 
  b) if PHP will work, or does work, with Apache 2 in this mode
 
 It works today.
 
  c) how database connection pooling will work with a single http/php
  multithreaded server process
 
 There is no database pooling.

Then how does pg_pconnect() work, for instance, when there's only a
single process that talks to the database? With persistent connections,
as they work now, you can have as many database connections per apache
child as you have databases hosted on your box. On our in-house server
(which is typically not very busy) it looks like this at the moment:

-- snip -- 
frank@limedes:~  ps ax |grep postgres
17954 ? S  0:09 postgres: wwwrun archi 127.0.0.1 idle
20479 ? S  0:00 postgres: wwwrun ip_adressen [local] idle
21576 ? S  0:12 postgres: wwwrun archi 127.0.0.1 idle
21707 ? S  0:00 postgres: nobody crewscout 192.168.100.220 idle
21736 ? S  0:00 postgres: nobody archimeta 192.168.100.220 idle
21737 ? S  0:00 postgres: nobody archimeta 192.168.100.220 idle
21738 ? S  0:00 postgres: nobody archimeta 192.168.100.220 idle
21739 ? S  0:00 postgres: nobody crewscout 192.168.100.220 idle
21740 ? S  0:00 postgres: nobody crewscout 192.168.100.220 idle
21777 ? S  0:00 postgres: nobody crewscout 192.168.100.220 idle
21844 ? S  0:00 postgres: nobody archimeta 192.168.100.220 idle
21845 ? S  0:00 postgres: nobody archimeta 192.168.100.220 idle
21846 ? S  0:00 postgres: nobody archimeta 192.168.100.220 idle
-- snap -- 

Which is not a problem at all. However, things start to get awkward when
the system gets busier: Say you have 20 apache children sitting around
waiting for clients, and each one of them has at some stage in their
career been asked to talk to each of the 5 databases using persistent
connections that are hosted on this box. This means you'd have 100
postgres processes sitting around, where most of them would be idle . .
.

 
  d) if maybe integrating php with a servlet engine as described in
 
  http://www.php.net/manual/en/ref.java.php
 
  allows you to use connection pooling via jdbc or something . . . ?
 
 Sure.

Gotta look into it, then! :)

 
  I am asking because connection pooling as it works now with persistent
  connections is pretty awkward, and leads me to look with envy on the
  Aolserver/TCL crowd . . . (I like PHP and see no reason to switch to TCL
  except for the connection pooling issue).
 
 Why do you think you need connection pooling?  Having contention for a
 small set of connections is certainly not going to speed anything up.  Is

Compared to persistent connections, there would be no speedup; compared
to non-persistent connections, yes there would - because with a
connection pool you don't incur the overhead of establishing a new
connection for every request, basically as with persistent connections.

 it because you have license issues and are only allowed a limited number
 of concurrent connections?

No, licensing is not an issue. I use persistent connections to offset
the overhead of creating a db connection in the first place, which is
considered hefty if you have simple queries (it matters less with more
expensive sql queries). Persistent connections are awkward because you
need to configure your database server to accept the number of
simultaneous connections that you actually need many times over, which
is not exactly resource-friendly and may bog down a busy server. Then
there's the added complication with transacations that is listed amongst
the caveats with persistent connections at

http://www.php3.de/manual/en/features.persistent-connections.php

The transaction issue supposedly does not arise with a
single-process/multithreaded/connection pooling server, presumably (never
wrote any pooling code myself . . . ) because it stems from the fact
that with a multiprocess server, you don't know which process will
answer the next request.

[ . . . ]
 There are also other options in the works for this problem.  The SRM
 project addresses this

Interesting . . . !

Regards, Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Installing PHP from CVS: `AM_PROG_LIBTOOL' not found in library

2001-05-22 Thread Frank Joerdens

Since I want to use a feature that is only in 4.0.6, I'm trying to
install from CVS. This fails with the following error:

[root@rakete php4]# ./buildconf
buildconf: checking installation...
buildconf: autoconf version 2.13 (ok)
buildconf: automake version 1.4 (ok)
buildconf: libtool version 1.4 (ok)
aclocal: configure.in: 889: macro `AM_PROG_LIBTOOL' not found in library
make[1]: *** [aclocal.m4] Error 1
make: *** [all] Error 2 

Does anyone have an idea what it means??? I found one reference about it
which suggested I do 

export ACLOCAL_FLAGS=-I /usr/share/aclocal 

since my libtool stuff is installed in a non-standard location. This
doesn't help though.

Does anyone know what this all means?

Cheers, Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: [PHP-DEV] Fork() in php?

2001-05-20 Thread Frank Joerdens

On Sun, May 20, 2001 at 01:43:36PM -0700, Rasmus Lerdorf wrote:
  Not really, the parent has to somehow call wait() on the child, otherwise
  you'd get zombie processes...
  Generally, implementing that sort of stuff within the Apache framework is a
  bit of asking for trouble :I
 
  Anyway, PHP really lacks of real multi-threading capabilities.  Things like
  database connection pooling, (non-HTTP) server request handling, and GUI
  event processing could be properly implemented in PHP with multi-threading
  capabilities like the way it is done in Java, Perl, Python, etc. but can't
  be done right in PHP because it lacks multi-threading support.
 
  Any plans to add multi-threading capabilities to PHP?
 
 Nope, but you can use the ticks feature to do some of this.

What is the ticks feature and where can I read about it? The only
reference I could find was in the PHP-DEV archives back in September
about something you call by doing register_tick_function() . . . but
nothing substantial in the way of documentation. 

Thanks,
Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: [PHP-DEV] Fork() in php?

2001-05-20 Thread Frank Joerdens

On Mon, May 21, 2001 at 01:55:10PM +1000, Greg Wright wrote:
[ . . . ]
 IIRC Rasmus was one of the main people involved in bringing PHP to life, it

Well, if anyone can be said to have invented it, it's Rasmus. At some
point around 96 (?) he was approached by Zeev and some others who
suggested to recode what was then PHP/FI from scratch. The outcome was
PHP 3.0 . . . shouldn't someone write a history of PHP?

A little anecdote I keep telling is that back in '97, when I asked my
very first question on this list, it was answered within less than half
an hour by the mighty Rasmus himself! Having worked with M$ stuff mostly
up until then if felt, wow, this is like, I post to Microsoft and get an
answer from Bill within the half-hour! I was undecided then as to which
scriptiong environment to go for. This won me over.

Cheers,
Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] parse error is always on line 1 == error ?

2001-04-27 Thread Frank Joerdens

On Fri, Apr 27, 2001 at 08:49:46AM +0200, Jimmy Lantz wrote:
 Hi, I have a problem,
 that when I get a parse error it always says that it's on line 1 in 
 this or that file.
 Where is the configuration option to set this right?

When I had this problem it turned out that the files in question had
been created on a Macintosh in Adobe GoLive, I think. The newline
characters in files created by this program are different to those used
on Unix or DOS computers, which messes up things to the effect that the
PHP parser only sees a single line. I used a tool from the Perl Power
Tools page to convert the Mac files to Unix format, and the problem went
away:

http://language.perl.com/ppt/src/nlcvt/index.html

Cheers, Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Flash XMLSocket object and the PHP socket functions

2001-04-09 Thread Frank Joerdens

I am currently thinking about how to implement a realtime chat using the
XMLSocket functionality in Macromedia Flash 5 using the PHP socket
functions. Here's a quote from the Flash 5 online help:

--- begin quote ---
Using the XMLSocket object

To use the XMLSocket object, the server computer must run a daemon that
understands the protocol used by the XMLSocket object. The protocol is
as follows: 

 XML messages are sent over a full-duplex TCP/IP stream socket
connection. 
 Each XML message is a complete XML document, terminated by
a zero byte. 
 An unlimited number of XML messages can be sent and
received over a single XMLSocket connection. 

The XMLSocket object is useful for client-server applications that
require low latency, such as real-time chat systems. A traditional
HTTP-based chat solution frequently polls the server and downloads new
messages using an HTTP request. In contrast, an XMLSocket chat solution
maintains an open connection to the server, which allows the server to
immediately send incoming messages without a request from the client. 

Setting up a server to communicate with the XMLSocket object can be
challenging. If your application does not require real-time
interactivity, use the loadVariables action, or Flash's HTTP-based XML
server connectivity (XML.load, XML.sendAndLoad, XML.send), instead of
the XMLSocket object. 

To use the methods of the XMLSocket object, you must first use the
constructor, new XMLSocket, to create a new XMLSocket object. 
--- end quote ---

Does anyone have any knowledge of similar projects/attempts to create a
server in PHP that would be able to talk to a client that uses the Flash
5 XMLSocket object, or would anyone care to provide some pointers to
other resources about it? I've never tried to write a server, but this
might solve quite a few problems that I encounter on a day-to-day basis.
Http really sucks when you try to do anything vaguely more complicated
than a mailto form, seeing that it is a stateless protocol . . . and
Flash 5 could fill that gap for the stuff I'd like to do at least.

Regards, Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] php under Oracle Web server pleaaaaaaaaaase!

2001-03-19 Thread Frank Joerdens

On Mon, Mar 19, 2001 at 10:27:19AM -, kaab kaoutar wrote:
 Hello
 
 Is it possible to work with php under an oracle server ?
 If yes can u point me to some manuals and articles

AFAIK, the Oracle Web server is not Open Source; hence it would be
difficult to support it directly. You can always use the CGI or servlet
options though. All the stuff for other web servers besides Apache is in
the source tree under:

/usr/src/php-4.0.4/sapi/

Regards, Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Using PHP as a shell script

2001-03-09 Thread Frank Joerdens

On Fri, Mar 09, 2001 at 03:07:34PM -0300, Alexandre Hautequest wrote:
 Hi all.
 
 Can i use PHP as a shell script, like bash? Or this is inviable, impossible
 and/or out of question?

There's a good tutorial at phpbuilder.com - check the archives there.

Regards, Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP as Scripting Language

2001-02-07 Thread Frank Joerdens

On Wed, Feb 07, 2001 at 12:10:46PM -0500, John Huggins wrote:
[ . . . ]

 host:~/projects/PHPScripts # ./test.php
 Content-type: text/html

 Hello World



 Great.  Now how do I get rid of the Content-type line?  I have
searched the
 docs with little clues.

#!/usr/local/bin/php -q

Is what you do. Annoyingly, though, this does not work if you use PHP
this way for CGI Programming . . .

Regards, Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] No input file specified. (using PHP for shell and CGI scripting)

2001-01-30 Thread Frank Joerdens

I am playing with PHP as a shell scripting tool and trying to use it for
CGI programming that way. This may seem kinda pointless, seeing that PHP
is _way_ more efficient when being used as an Apache module. However I
need to pass stuff from a database query to another CGI program which
is designed to take ouput from a shell command as input (I can also use
GET to directly pass arguments to this program, but that doesn't work
for larger amounts of data). The problem is this: Running a PHP script
from a shell, as in

#!/usr/local/bin/php -q
?

$conn = pg_connect("dbname=mpi");

$result = pg_exec($conn, "SELECT id FROM index ORDER BY id;");

$rows = pg_numrows($result);

for ($i=0; $i$rows; $i++) {

// spit out rows etc . . . .

}

?

works fine. When I try to call the PHP script from the CGI program, I'll
always get:

X-Powered-By: PHP/4.0.3pl1
Content-type: text/html

No input specified.

The very same happens when I exec the PHP script from a BASH script
which normally generates correct CGI output (I am using the test-cgi
script that comes with Apache).

Just trying to run a very simple PHP script as a CGI program like

#!/usr/local/bin/php

echo "bla"

will _also_ produce the above "No input specified." message.

The http header will appear in spite of the -q parameter when exec'ing
the script from within another CGI program. When runnign the PHP script
"standalone" it will only produce "No input specified.", with or without
-q. I'm stumped.  What input is PHP expecting? It behaves like any
scripting language on the command line but does weird things when http
is involved it seems.

Can anyone enlighten me?

Cheers Frank

-- 
frank joerdens   

archi|me|des  
urbanstr. 116
10967 berlin
germany

e: [EMAIL PROTECTED]  
t: +49 (0)30 69597650
f: +49 (0)30 7864046 
h: http://www.archi-me-des.de

pgp key: http://www.joerdens.de/pgp/frank_joerdens.asc

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Zend IDE price plans

2001-01-27 Thread Frank Joerdens

On Sat, Jan 27, 2001 at 10:26:35AM -0500, Jim Jagielski wrote:
[ . . . ]
 You mean like the Commercial Subscription ($70/month) ?? The Encoder
 SE is available with that plan. In fact, that's almost the whole idea
 behind the Commercial subscription: to allow a very low entry for access
 to the Encoder technology.

You need to buy a whole year's subscription though. This means you don't
pay $70 a month but 12*$70=$840 a year, in monthly installments. There
is a difference between 'amount X a month' and 'amount Y a year in
monthly installments'. If X happens to be Y/12, it's still not the same.

Just my $0.02.

- Frank


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Persistent connections and transactions

2001-01-26 Thread Frank Joerdens

On Fri, Jan 26, 2001 at 11:01:14AM +, Nuno Silva wrote:
[ . . . ]
 i ran across this transaction problem vs. persistent conn in pgsql some time ago.
 
 I found two workaround methods:
 - don't use persistent conn's :-) or;
 - start every conn with the usual pg_pconnect and then query a rollback to the 
server:
 $query="ROLLBACK work;"
 
 (this will kill any supposed transaction in ABORT STATE that some child had left).
 
 postgres don't support nested transactions (yet), but when it does maybe you should 
add multiple "ROLLBACK WORK;" queries :-)

Ah. Very cool. What I _still_ don't quite understand, though, is _how_
exactly this situation could come about. And what the worst case would
be. What if you don't kill the transaction in ABORT STATE?

Ta, Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Persistent connections and transactions

2001-01-25 Thread Frank Joerdens

On the PostgreSQL lists there has been some discussion recently as to
the mechanism behind, benefits and drawbacks, of persistent connections.
In particular a scenario similar to the following was brought up:

Browser A connects to Apache child N, and calls a web page that calls a
script which issues SQL commands that involve opening and committing a
transaction:

- begin work;
- do some selects, inserts, deletes, updates . . .

Now, the question is: Is it conceivable that in the meantime, whilst
Browser A is waiting for the output from the script, that Browser B
talks to same Apache child, uses the same persistent connection, and
messes up the transaction that Browser A initiated in some unpredictable
way? 

- do more selects, inserts, deletes, updates . . .
- commit work;

My guess would be that the Apache child wouldn't allow Browser B to talk
to it whilst Browser A is waiting for output from the script and that
that means that everything is fine and hunky-dory . . . I'm not sure though,
and there is nagging trace of murkiness.

Cheers, Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Persistent connections and transactions

2001-01-25 Thread Frank Joerdens

On Thu, Jan 25, 2001 at 11:18:49AM -0300, Martin A. Marques wrote:
[ . . . ]
 No, and thats why in the postgres list we talked about persistent connections 
 not having much benefits. That is because the connection is persistent to the 
 httpd child that called it and not to all.

Well, yes, but as long as the child lives, it'll be connected which
means that every subsequent request to this child involving a database
connection won't have to suffer the connection startup cost. If you have
a rather inexpensive query, and a lot of web apps use simple,
straightforward selects that are very inexpensive, then the connection
startup overhead contributes more to the performance hit than the actual
query.

[ . . . ]
 Now be carefull. http connection open and close, they do not stay open, so if 
 you try to execute different SQL statments with different httpd connections, 
 your gonna have trouble (the sql server won't let you, because there is 
 another transaction been executed).

Hmm. Say the Apache child is idle (under which cirumstances exactly does
it consider itself 'idle'?), receives a request for a page which
executes a query (because it contains php code that does). This takes a
while. In the meantime, while the SQL server is chugging away running
the query, will the Apache child not accept further http requests? How
does the Apache child know that it is waiting for the query to complete?
This is what I don't know about the mechanism.

Regards, Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Persistent connections and transactions

2001-01-25 Thread Frank Joerdens

On Thu, Jan 25, 2001 at 05:10:54PM -0300, Martin A. Marques wrote:
[ . . . ]
 OK, lets see if we can understand what each other is saying (maybe I'm not 
 getting your point here).
 Lets say browser A connects to the apache server, to a page using php code. 
 Lets say the code is OK (no bugs). Apache opens a persistent connection to 
 the database and starts executing the queries. Now the connection between the 
 apache server and the web browser doesn't close until the queries are all 
 finished and the output is send back to the browser.
 Now, how about if browser B connects to the apache server just in the middle 
 of the execution of the queries that browser A asked for?
 Well, the connection between Browser A and the web server is still opened, so 
 another httpd child process answers the request.

I thought one of the points being raised (can't find the mail/thread I'm
referring to now) was that somehow confusion might ensue from a mix-up,
on the Apache/PHP level, regarding the client identity, thus corrupting a
transaction in progress. It seemed to make sense but now that we've
discussed it, I can't see anymore how it might happen.

 . . . [ goes away to search mail archives ] . . .

Ah, here we go. A post from Rod Taylor on pgsql-hackers on Dec 27:

-- begin quote --
The *real* problem with persistent connections is:

Script1:  BEGIN;
Script1:  UPDATE table set row = 'things';
Script2:  Insert into table (id) values ('bad data');
Script1: COMMIT;

Since script2 managed to do a BAD insert in the middle of script1's
transaction, the transaction in script1 fails.  Obvious solution?  Don't
do
connection sharing when a transaction is enabled.  The whole persistent
connection thing is only valid for mysql as it's the only thing that
doesn't
really support transactions (and even thats partially changed).

They need to look for stuff going through (keywords like BEGIN) and
'lock'
that connection to the single entity that opened it.

It's much easier to write your own.  I wrote a few functions like:

get_connection('DB PARMS');
begin_transaction();

commit_transaction();
close_connection();
-- end quote --

[ . . . ]
 My question would be, and seeing Adams thoughts, wouldn't it be the best 
 optimization configuration of php.ini to have only one persistent conection? 
 Wouldn't there be one per-child? Any way, you can't have two connections to 
 the same httpd child.

Those where my thoughts too (or, rather, Adams thoughts ;)), and this is
what I am trying at the moment.

Regards, Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] flash and php

2001-01-18 Thread Frank Joerdens

On Thu, Jan 18, 2001 at 04:23:58PM -0600, Jacky@lilst wrote:
 Hi people,
 Can PHP3 work with flash movie? I mean, something like using Php3 to run flash 
content from db? If so, is there anywhere I can find out more information?

I use swift-generator from www.swift-tools.com, which integrates nicely
with any server-side scripting method. It's not open source but still
rather inexpensive (unlike Macromedia Generator).

- Frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]