我嘗試編譯 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
1 回答

達令說
TA貢獻1821條經驗 獲得超6個贊
結果是這樣的:
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 等其他系統上,它可能更快。
MPM Worker
在 Apache 配置中默認選擇模式。
由于我剛剛制作make install
并且從未更改過 Apache conf 文件選擇是MPM Worker
. 這是從 PHP 配置腳本中提取的,結果是線程安全的 PHP。
我確實MPM prefork
在 Apache conf 中進行了選擇,并且 PHP 編譯符合預期。
- 1 回答
- 0 關注
- 163 瀏覽
添加回答
舉報
0/150
提交
取消