Page 1 of 1

PHP thread-safe config...

Posted: Mon Sep 18, 2006 8:05 pm
by laserbeamninja
Hi Ya'll...

trying to build PHP5 for a somewhat unusual configuration...

Apache 2 / SSL
thread-safe mode
Mac OS 10.4

Using this configure command


% ./configure \
% --prefix=/sw/etc/apache2/php \
% --with-zlib \
% --with-xml \
% --with-ldap=/usr \
% --enable-cli \
% --with-zlib-dir=/usr \
% --enable-exif \
% --enable-mbstring \
% --enable-mbregex \
% --enable-dbx \
% --enable-sockets \
% --with-iodbc=/usr \
% --with-curl=/usr \
% --with-mysql=/usr/local/mysql \
% --with-apxs2=/sw/sbin/apxs \
% --enable-roxen-zts \
% --enable-safe-mode \
% --enable-thread-safty \
% --with-ssl=/sw/etc/ssl \
% --enable-ssl=/sw/etc/ssl
% sudo make
% sudo make install


% sudo apache sslstart

I get this error when I start apache:

Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
Pre-configuration failed

Primarily I am trying to get thread-safety installed correctly.

Anyone see what I'm doing wrong?

Thanks,
Christopher

Posted: Mon Sep 18, 2006 8:08 pm
by feyd
PHP doesn't do multithreading.

Posted: Mon Sep 18, 2006 8:16 pm
by laserbeamninja
Is that true though?

Look, I am not a PHP expert, but it seems to me I've read several articles today only whilst I've been attempting this, and there is a libthread something that I've been building in to PHP and as I said Apache directly references it in the error above so, it would seem to me to be untrue.

Can anyone give me some more information about this?

Thanks,
Christopher

Posted: Mon Sep 18, 2006 8:26 pm
by feyd

Posted: Mon Sep 18, 2006 8:48 pm
by laserbeamninja
Okay thanks.

I am put in a perdicament then. Is it possible to run multiple instances of apache on separate ports... For instance, both apache 2, one w/ threading enabled and one w/out?

I appreciate any help w/ this.

Thanks,
Christopher

Posted: Mon Sep 18, 2006 8:53 pm
by feyd
Yes, it can be done. Although you may want to look into using CGI.

Posted: Mon Sep 18, 2006 9:01 pm
by laserbeamninja
For my purposes, I need the threaded apache running for reasons unrelated to php and html. Do you mean I should use php in CGI mode, or are you saying switch from php altogether. The php is used on a site we're redesigning, and we'd like not to switch systems on them. I think I could suffice with an instance of apache running in forked mode just to test php specifically.

Thanks,
Chris

Posted: Mon Sep 18, 2006 9:08 pm
by feyd
I'm talking of PHP-CGI.

Posted: Mon Sep 18, 2006 9:34 pm
by laserbeamninja
Cool I am looking into that. I am tempted to go the other way, because it seems like it might be easier, but maybe not. If I understand correctly, using PHP as a CGI will allow PHP5 to run on apache, even though I am using the threaded MPM and most of the PHP libraries are not thread-safe, thus crippling PHP. Do I comprehend u proper?

Posted: Mon Sep 18, 2006 10:51 pm
by feyd
Unless CGI interactions have changed in the last six or so years (on the base level) running under CGI, PHP would be a separate process for every request instance. So yes, you should be able to run PHP 5 with a multithreaded MPM under Apache.

Posted: Mon Sep 18, 2006 11:06 pm
by laserbeamninja
okay thank you for enlightening me. yes i am uninformed in this arena. but seriously thanks for your help, because i am figuring this out slowly but surely.