我尝试编译php 5.6、php 7.1和php 7.3
令我惊讶的是,它们都是用ZTS编译的。
我使用了我一直使用的相同选项,但这次有所不同。我怀疑是Apache,但它也是用我常用的选项编译的。
有什么想法吗?
阿帕奇
./configure --prefix=/usr/local/httpd-2.4.41 --enable-modules=all --enable-mods-shared=all --enable-mpms-shared=allphp
./configure --prefix=/usr/local/php-7.1.33-2.4 --with-apxs2=/usr/local/httpd-2.4.41/bin/apxs \
--with-mysqli=shared --with-pdo-mysql=shared \
--with-sqlite3=shared --with-pdo-sqlite=shared \
--with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr \
--with-openssl=shared \
--enable-pcntl=shared --enable-sockets=shared \
--enable-ftp=shared \
--with-curl=shared \
--with-mhash=shared \
--enable-wddx=shared \
--enable-mbstring=shared \
--enable-intl=shared \
--enable-exif=shared \
--with-gmp=shared \
--enable-calendar=shared \
--enable-soap=shared \
--with-zlib=shared --enable-zip=shared \
--enable-bcmath=shared发布于 2019-11-29 01:38:11
结果是这样的:
Apache服务器可以与多个MPM模块一起工作。可能有99%的PHP安装使用MPM prefork
https://httpd.apache.org/docs/2.4/mod/prefork.html
在这种模式下,apache通过fork()产生几个子进程,PHP不需要是线程安全的。
在Linux下这个模式是非常快的,因为Linux有非常快的fork()。它和基于线程的程序一样快。
但是,在安装Apache时,配置文件使用MPM Worker。
https://httpd.apache.org/docs/2.4/mod/worker.html
此模式不使用fork(),而是使用线程。对于这种模式,PHP必须是线程安全的。
在Linux上,MPM Worker + PHP比MPM prefork慢,但在其他系统上,比如Windows和MacOS,它可能更快。
在Apache配置中,默认选择MPM Worker模式。
由于我只创建了make install,并且从未更改过Apache conf文件,因此选择的是MPM Worker。这是从PHP配置脚本中提取的,结果是线程安全的PHP。
我确实在Apache conf中选择了MPM prefork,PHP编译就像预期的那样。
https://stackoverflow.com/questions/59092056
复制相似问题