FreeBSD 12.1 RELEASE - apache24 - PHP - PHP 7.4 インストール

クラウディア 
1. 概要
2. php74
3. php74-extensions
4. mod_php74

1. 概要

 PHP の詳細については「ウィキペディア - PHP」をご参照ください。  ここでは、ウェブサーバ上でデータベースを動作させるのを主目的とします。  先に apache や使用しようとするデータベースをインストールしてください。

2. php74

 「PHP (プログラミング言語) - Wikipedia」によれば、「PHP7.4」が、2019年11月28日には、リリースされているようです。  「ports」にも登録済のようですので、「PHP7.4」を試してみます。  試してみたところ、CMS で、「PHP7.4」が使えない可能性があります。  「PHP 7.2」の方が確実なようです。

cd /usr/ports/lang/php74
make config
 スレッドセーフに動作させるには「ZTS」のオプションが必須になりますので、「ZTS」のオプションにチェックをいれます。  後は、デフォルトのままで。
「FreeBSD 12.1 RELEASE」-「/usr/ports/lang/php74」「make config」


cd /usr/ports/lang/php74
make
make install
 例によって依存関係があり、自動的にインストールされるものについては記述しません。  インストール時のメッセージを記載します。

===>  Installing for php74-7.4.0.r5
===>  Checking if php74 is already installed
===>   Registering installation for php74-7.4.0.r5
Installing php74-7.4.0.r5...
===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/bin/php
/usr/local/bin/php-cgi
/usr/local/sbin/php-fpm
/usr/local/lib/libphp7.so

      This port has installed the following startup scripts which may cause
      these network services to be started at boot time.
/usr/local/etc/rc.d/php-fpm

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
https://www.php.net/

3. php74-extensions


cd /usr/ports/lang/php74-extensions
make config
 デフォルトでチェックされているものはチェックをはずさないように。  WordPress をインストールする予定があれば、更新のために「CURL」は、必須でチェックします。  「GD」「GETTEXT」も他のモジュールで使うことがあるのでチェックしておいた方がいいでしょう。
「FreeBSD 12.1 RELEASE」-「/usr/ports/lang/php74-extensions」「make config ①」

 日本語を使用するのであれば「MBSTRING」は、必須でチェックします。
 (とういうか、これが日本人にとって一番大事かもしれない)

 MySQL を使用するのであれば「MYSQLI」は、必須でチェックします。
 WordPress をインストールする予定があれば、更新のために「OPENSSL」は、必須でチェックします。

「FreeBSD 12.1 RELEASE」-「/usr/ports/lang/php74-extensions」「make config ②」

 postgreSQL を使用するのであれば「PGSQL」は、必須でチェックします。

「FreeBSD 12.1 RELEASE」-「/usr/ports/lang/php74-extensions」「make config ③」

 SYSTEM Ⅴ 系のモジュールを使用するのであれば「SYSVMSG」「SYSVMEM」「SYSVSHM」をチェックします。
 (通常は、必要ないかな)

「FreeBSD 12.1 RELEASE」-「/usr/ports/lang/php74-extensions」「make config ④」

 WordPress をインストールする予定があれば「ZLIB」は、必須でチェックします。

「FreeBSD 12.1 RELEASE」-「/usr/ports/lang/php74-extensions」「make config ⑤」

 上記にデータベースのチェックについて記述していますが。
 先にデータベースをインストールしていないと、php のインストール時に意図しないバージョンのクライアントがインストールされることがあります。
 使用予定のバージョンがあれば php より先にデータベースをインストールしておきます。


cd /usr/ports/lang/php74-extensions
make
make install
 mbstring について今後、ports のインストール時に設定を反映するように

/etc/make.conf
 に以下の1行を追加しておきます。

OPTIONS_SET+=MBSTRING

4. mod_php74


cd /usr/ports/www/mod_php74
make config
 スレッドセーフを考慮して「APZFILTER」「PHPDBG」「DEBUG」以外のものすべてをチェックします(DEBUG を有効にするとこけます)。
「FreeBSD 12.1 RELEASE」-「/usr/ports/www/mod_php74」「make config」


cd /usr/ports/www/mod_php74
make
make install
ハイスピードプランJETBOY