RE: [PHP] Apache Config: php_value auto_prepend_file auto_append_file

2004-03-13 Thread Rasmus Lerdorf
It's a chicken and egg problem.  Until enough people, especially core PHP
folks, start using Apache2 seriously, it is not going to have enough
experienced eyes fixing the various little niggly things like this.  In
this case it is unlikely to have anything to do with threading.  It's
probably simply a bug that none of us have seen before because we are not
using the server.  Then again, it could be a threading issue.  Until
someone takes a serious look at it we have no idea.

And this brings us to the core problem.  Debugging a complex threaded
system is difficult.  We don't have decent tools to help us and the pool
of developers available to us that can actually do this is smaller.  When
someone submits a bug that says something is broken in PHP under Apache2
we first need to know which OS we are dealing with.  Then which libc
version.  Then which extensions are enabled and which versions of the
3rd-party libraries we are dealing with.  And often we need to know
exactly how these 3rd-party libraries were compiled (compiler, compiler
version, compile-time flags).  This stuff can all be done of course, but
it is exponentially more difficult.

All this pretty much leaves us with only realistically being able to
guarantee that PHP will work with Apache2 when you use the prefork MPM
when we are talking about the general case of working across all operating
systems with all extensions.  There is no doubt that for a given OS, a
given libc and a given set of extensions and their correponding
3rd-party libraries Apache2+PHP can work very well.  But since we don't
know these combinations and we really want to make PHP useful across a
broad range of environments there is a big motivation to try to keep the
base architecture as simple as possible such that problems are transparent
and easy to fix with the relatively primitive debugging tools available to
us today.

So the current situation is that Apache2-prefork+PHP is a decent solution
but it hasn't been tested a whole lot.  And given that there are actually
very few feature benefits to moving from Apache1 to Apache2-prefork few
people are spending time battlehardening that combination.

My own personal belief which many people disagree with is that humans in
general are not smart enough to write threadsafe code on a large scale.
And furthermore, I do not believe it is something that should be done in
userspace at all.  The operating system should be in charge of most
efficiently scheduling when and where things should run.  And for all the
benefits that the threading-proponents will throw at you, there are quite
a few drawbacks as well.  Try benchmarking threaded malloc vs.
non-threaded malloc for example.  Heck, benchmark something linked against
libpthreads vs. not linked against it regardless of whether you are
explicitly calling any functions in it.  The results will probably
surprise you.  This little thread benchmark test program:
http://samba.org/ftp/unpacked/junkcode/thread_perf.c
can be used to have a look at just how much slower some very basic
operations are when run in a threaded environment.  And the more cpus you
throw in the machine the worse it scales.

Of course, some of this is being addressed in modern kernels.  The New
Posix Thread Library (NPTL) in the Linux 2.6 kernel does a much better job
when dealing with a lot of threads on SMP machines.  At the same time
however, the new O(1) scheduler in 2.6 also improves performance when
running with thousands of processes on an SMP machine.  Most people aren't
running bleeding edge kernels though.  Linux 2.4.x, FreeBSD 4.x, AIX 4.x
and many others do a piss-poor job of dealing with highly threaded apps,
especially on SMP boxes.

-Rasmus


On Sat, 13 Mar 2004, electroteque wrote:

 I've prob asked this before, when will it be possible to be able to use
 Apache2 ? I assumed as you said before it was because it was the
 extensions but are we saying now that libraries that php are compiled on
 are too not thread safe ?


 -Original Message-
 From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]
 Sent: Saturday, March 13, 2004 5:25 PM
 To: Chris Wagner
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Apache Config: php_value auto_prepend_file 
 auto_append_file


 Yeah, probably a config leak in the Apache2 sapi module.  There is a
 reason we don't suggest using PHP with Apache2 yet.  Use Apache1 and I bet
 you won't have any problems.

 -Rasmus

 On Sat, 13 Mar 2004, Chris Wagner wrote:

  hi,
 
  i'm running a server with Fedora Core 1.  this is using Apache 2.0.48
  and PHP 4.3.4.
 
  i have my http server root at /var/www/html/.  i have some virtual hosts
  setup.
 
  i've just installed phpMyAdmin 2.5.6.  my problem lies within the
  auto_prepend_file and auto_append_file directives provided by PHP.  i
  have no default prepended or appended files, but have these directives
  set up for each virtual host.  so, the section of my httpd.conf file
  that takes care of this, looks like so:
 
  Directory /var

[PHP] Apache Config: php_value auto_prepend_file auto_append_file

2004-03-12 Thread Chris Wagner
hi,

i'm running a server with Fedora Core 1.  this is using Apache 2.0.48
and PHP 4.3.4.

i have my http server root at /var/www/html/.  i have some virtual hosts
setup.

i've just installed phpMyAdmin 2.5.6.  my problem lies within the
auto_prepend_file and auto_append_file directives provided by PHP.  i
have no default prepended or appended files, but have these directives
set up for each virtual host.  so, the section of my httpd.conf file
that takes care of this, looks like so:

Directory /var/www/html/virtual_host1
  php_value auto_prepend_file /var/www/html/virtual_host1/header.php
  php_value auto_append_file /var/www/html/virtual_host1/footer.php
/Directory

Directory /var/www/html/virtual_host2
  php_value auto_prepend_file /var/www/html/virtual_host2/header.php
  php_value auto_append_file /var/www/html/virtual_host2/footer.php
/Directory


now, i have no header or footer defined for phpMyAdmin, which lies under
/var/www/html/phpMyAdmin/.  but what happens, is that the header and
footer from my 1st virtual host are randomly included, making phpMyAdmin
look hideous, and often making it not work because it needs to place
information in the HTML Header.  whether or not these files are included
seems to be quite random, tho, as it does not happen all the time.  i
could log into phpMyAdmin just fine, browse through a few tables, and
then it will begin including the header and footer.  another thing i've
noticed though, is that these files never get included in the Fedora
Core Apache Test Page, which lies under /var/www/html/.

i think this looks like a bug in either PHP or Apache...  any ideas?

thanks!

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



Re: [PHP] Apache Config: php_value auto_prepend_file auto_append_file

2004-03-12 Thread Rasmus Lerdorf
Yeah, probably a config leak in the Apache2 sapi module.  There is a
reason we don't suggest using PHP with Apache2 yet.  Use Apache1 and I bet
you won't have any problems.

-Rasmus

On Sat, 13 Mar 2004, Chris Wagner wrote:

 hi,

 i'm running a server with Fedora Core 1.  this is using Apache 2.0.48
 and PHP 4.3.4.

 i have my http server root at /var/www/html/.  i have some virtual hosts
 setup.

 i've just installed phpMyAdmin 2.5.6.  my problem lies within the
 auto_prepend_file and auto_append_file directives provided by PHP.  i
 have no default prepended or appended files, but have these directives
 set up for each virtual host.  so, the section of my httpd.conf file
 that takes care of this, looks like so:

 Directory /var/www/html/virtual_host1
   php_value auto_prepend_file /var/www/html/virtual_host1/header.php
   php_value auto_append_file /var/www/html/virtual_host1/footer.php
 /Directory

 Directory /var/www/html/virtual_host2
   php_value auto_prepend_file /var/www/html/virtual_host2/header.php
   php_value auto_append_file /var/www/html/virtual_host2/footer.php
 /Directory


 now, i have no header or footer defined for phpMyAdmin, which lies under
 /var/www/html/phpMyAdmin/.  but what happens, is that the header and
 footer from my 1st virtual host are randomly included, making phpMyAdmin
 look hideous, and often making it not work because it needs to place
 information in the HTML Header.  whether or not these files are included
 seems to be quite random, tho, as it does not happen all the time.  i
 could log into phpMyAdmin just fine, browse through a few tables, and
 then it will begin including the header and footer.  another thing i've
 noticed though, is that these files never get included in the Fedora
 Core Apache Test Page, which lies under /var/www/html/.

 i think this looks like a bug in either PHP or Apache...  any ideas?

 thanks!

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


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



RE: [PHP] Apache Config: php_value auto_prepend_file auto_append_file

2004-03-12 Thread electroteque
I've prob asked this before, when will it be possible to be able to use
Apache2 ? I assumed as you said before it was because it was the
extensions but are we saying now that libraries that php are compiled on
are too not thread safe ?


-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 13, 2004 5:25 PM
To: Chris Wagner
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Apache Config: php_value auto_prepend_file 
auto_append_file


Yeah, probably a config leak in the Apache2 sapi module.  There is a
reason we don't suggest using PHP with Apache2 yet.  Use Apache1 and I bet
you won't have any problems.

-Rasmus

On Sat, 13 Mar 2004, Chris Wagner wrote:

 hi,

 i'm running a server with Fedora Core 1.  this is using Apache 2.0.48
 and PHP 4.3.4.

 i have my http server root at /var/www/html/.  i have some virtual hosts
 setup.

 i've just installed phpMyAdmin 2.5.6.  my problem lies within the
 auto_prepend_file and auto_append_file directives provided by PHP.  i
 have no default prepended or appended files, but have these directives
 set up for each virtual host.  so, the section of my httpd.conf file
 that takes care of this, looks like so:

 Directory /var/www/html/virtual_host1
   php_value auto_prepend_file /var/www/html/virtual_host1/header.php
   php_value auto_append_file /var/www/html/virtual_host1/footer.php
 /Directory

 Directory /var/www/html/virtual_host2
   php_value auto_prepend_file /var/www/html/virtual_host2/header.php
   php_value auto_append_file /var/www/html/virtual_host2/footer.php
 /Directory


 now, i have no header or footer defined for phpMyAdmin, which lies under
 /var/www/html/phpMyAdmin/.  but what happens, is that the header and
 footer from my 1st virtual host are randomly included, making phpMyAdmin
 look hideous, and often making it not work because it needs to place
 information in the HTML Header.  whether or not these files are included
 seems to be quite random, tho, as it does not happen all the time.  i
 could log into phpMyAdmin just fine, browse through a few tables, and
 then it will begin including the header and footer.  another thing i've
 noticed though, is that these files never get included in the Fedora
 Core Apache Test Page, which lies under /var/www/html/.

 i think this looks like a bug in either PHP or Apache...  any ideas?

 thanks!

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


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

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