Re: PHP 4.3.10 and Apache2.0 with MPM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Info@Best-IT wrote:
> When I install PHP 4.3.10 with Apache 2.0 with a tool called YUM that
> installs rpms for Fedora Core 3 I get the following:
>
> Apache is running a threaded MPM, but your PHP Module is not compiled to
> be
> threadsafe.  You need to recompile PHP.  Pre-configuration failed
>
> I¹m not sure why Fedora would distribute a package that wouldn¹t work with
> other packages, however what is this ?threadsafe¹ feature and how can I
> specifically enable it so I can get php installed?

"Threads" are, crudely put, allowing a program to "clone" itself and run
multiple copies of itself at one time, sharing some data among the various
threads in the strand of program execution, but mostly having each thread
running independently.

Some perfectly good programs were written with no intent to ever run in a
threaded environment.  Such programs might, or might not, handle data in a
way that, if they *ARE* run in a threaded environment, will crash the
computer very very very nastily.

Consider this PHP script, for example:
<?php
  function do_not_thread_me(){
    static $foo;
    $foo++;

    echo "foo is now $foo<br />\n";
    return $foo;
  }
?>

It just keeps a counter going throughout program execution.

But what happens when, suddenly, *TWO* threads are running that same
function AT ONE TIME.

Whammo!

They *both* try to alter $foo, and they are both expecting $foo to
increase by 1 in each function call, but the *other* thread is messing
with $foo, and $foo is *NOT* gonna behave the way they expect.

So, either *ALL* your programs that get compiled together have to be
thread-safe, or *none* of them should use threads.

You chose an Apache that was specifically compiled to use threads.

That has certain advantages.

It also has the disadvantage that all the Apache Modules you use, and any
sub-Module of those Modules, must all be specifically compiled to use
threads.

More importantly, all that software has to have been specially programmed,
tested, and re-tested, to be *SURE* it's not doing something that will
crash under threads.

Your PHP was not compiled with threads.

You can either re-compile/download an Apache2 that doesn't use threads, or
re-compile/download a PHP and all its Modules to use threads.

WARNING:
Just because you can COMPILE with threads "on" doesn't mean that anybody
has thoroughly tested and debugged the Module you compiled with threads
"on"

You may be creating a disaster waiting to happen.

It will frequently not even manifest for a lonnnnnnnggg time until two
threads just *HAPPEN* to "do something" that wasn't thread safe.

It could be a few minutes, a few days, a few months, or even a few years
before that happens.

It's all a matter of probabiliy and which functions are getting called
when by the program whether or not something like my example function
above will happen.

Your safest bet is to back off from the threads version of Apache 2, and
stick with non-threaded software.

Your second option is to try the thread stuff, but test the hell out of it
before you put it on a "real" site where you care if it crashes or not.

Some people want threads.  Some would rather be safer.  RedHat has to
cater to both groups.

-- 
Like Music?
http://l-i-e.com/artists.htm

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux