APACHEでPHPインストールの躓き 2021年10月23日 PHP5をインストールし、設定を終わった後APACHEを再起動しようとしたらエラーが発生しました。 # /etc/rc.d/init.d/apache2 restart Apache2 HTTP Serverを停止中: [ 失敗 ] Apache2 HTTP Serverを起動中: [Tue Sep 11 00:30:21 2012] [crit] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP. Pre-configuration failed なんでだろう?と色々調べてみたらPHP5インストールの際にメッセージが表示されていると書かれているので早速調べてみると Apache2 is configured to use worker MPM. But php5-apache2 requires prefork MPM. Run the following command as root to switch MPM: /sbin/update-alternatives --config apache2 書いてましたorz ということで書かれている通りにやってみよう /sbin/update-alternatives --config apache2 2 プログラムがあり 'apache2' を提供します。 選択 コマンド ----------------------------------------------- + 1 /usr/sbin/apache2.worker * 2 /usr/sbin/apache2.prefork Enter を押して現在の選択 [+] を保持するか、選択番号を入力します:2←2を選択 後はapacheを再起動 /etc/rc.d/init.d/apache2 restart Apache2 HTTP Serverを停止中: [ 失敗 ] Apache2 HTTP Serverを起動中: [ OK ] ちょこっと解説すると preforkはAPACHE1.3から使われている機能 wokerはAPACHE2から使われている機能 だったかな。 プロセスやスレッドの取りまわりとかで違いがあるようです。(wokerのほうがパフォーマンスが良いらしい?) 個人レベルのサーバーでしたらあまり気にしなくてもいいと思います。 場合によりPHPはpreforkじゃないと動けないよ という警告だったのです。 (wokerのまま使いたいならばPHPをリビルドする必要があり少しめんどくさいことになりますしね。) 気が向いたらPHP5のwokerバージョンの備忘録でも作ろうかな。