- 1. 概要
- 2. php80
- 3. php80-extensions
- 4. mod_php80
1. 概要
「PHP」の詳細については「ウィキペディア - PHP」をご参照ください。
ここでは、ウェブサーバ上でデータベースを動作させるのを主目的とします。
先に「apache」や使用しようとするデータベースをインストールしてください。
2. php80
「PHP (プログラミング言語) - Wikipedia」によれば、「PHP8.0」が、2020年11月にリリースされています。
今まで(2021年5月27日)、「PHP7.2」のインストールに関して書いてきましたが、「PHP8.0」は、引数の型指定に不定を置くことが魅力で使ってみたかったのです。
「PHP」を基本としているフレームワークでは、「PHP8.0」には、まだ対応できていないものがあるかもしれないので、ご注意ください。
ちなみに「Laravel」は、「PHP8.0」で動作します。
cd /usr/ports/lang/php80
make config
スレッドセーフに動作させるには「ZTS」のオプションが必須になりますが・・・。
「PHP8.0」で、「ZTS」のオプションをいれると少なくとも、わたしの環境では、メモリ不足で、「make」に失敗しますので、「ZTS」のオプションには、絶対にチェックをいれません。
結局すべて、デフォルトのままで。

cd /usr/ports/lang/php80
make
make install
例によって依存関係があり、自動的にインストールされるものについては記述しません。
インストール時のメッセージを記載します。
===> Installing for php80-8.0.6
===> Checking if php80 is already installed
===> Registering installation for php80-8.0.6
Installing php80-8.0.6...
===> 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/lib/libphp.so
/usr/local/bin/php
/usr/local/bin/php-cgi
/usr/local/sbin/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. php80-extensions
cd /usr/ports/lang/php80-extensions
make config
オプションが、ここにはる画像で一枚分、今までのバージョンより少なくなっています。
あまり多すぎるとわからなくなるので、ありがたいことです。
デフォルトでチェックされているものは、チェックをはずさないように。
「WordPress」をインストールする予定があれば、更新のために「CURL」は、必須でチェックします。
「GD」「GETTEXT」も他のモジュールで使うことがあるのでチェックしておいた方がいいでしょう。

日本語を使用するのであれば「MBSTRING」は、必須でチェックします。
(とういうか、これが日本人にとって一番大事かもしれない)
「MySQL」を使用するのであれば「MYSQLI」は、必須でチェックします。
「WordPress」をインストールする予定があれば、更新のために「OPENSSL」は、必須でチェックします。
「postgreSQL」を使用するのであれば「PGSQL」は、必須でチェックします。
「SYSTEMⅤ」系のモジュールを使用するのであれば「SYSVMSG」「SYSVMEM」「SYSVSHM」をチェックします。
(通常は、必要ないかな)
「WordPress」をインストールする予定があれば「ZLIB」は、必須でチェックします。
上記にデータベースのチェックについて記述していますが。
先にデータベースをインストールしていないと、「php」のインストール時に意図しないバージョンのクライアントがインストールされることがあります。
使用予定のバージョンがあれば、「php」より先にデータベースをインストールしておきます。
cd /usr/ports/lang/php80-extensions
make
make install
「mbstring」について今後、「ports」のインストール時に設定を反映するように
vi /etc/make.conf
以下の1行を追加しておきます。
OPTIONS_SET+=MBSTRING
4. mod_php80
cd /usr/ports/www/mod_php80
make config
前の方の項で述べたように「ZTS」オプションは、今回つけません。
なので、デフォルトのままにしておきます。

cd /usr/ports/www/mod_php80
make
make install
インストール時のメッセージを記載しておきます。
===> Installing for mod_php80-8.0.6
===> Checking if mod_php80 is already installed
===> Registering installation for mod_php80-8.0.6
Installing mod_php80-8.0.6...
[activating module `php' in /usr/local/etc/apache24/httpd.conf]
******************************************************************************
Make sure index.php is part of your DirectoryIndex.
You should add the following to your Apache configuration file:
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
******************************************************************************
If you are building PHP-based ports in poudriere(8) or Synth with ZTS enabled,
add WITH_MPM=event to /etc/make.conf to prevent build failures.
******************************************************************************
===> 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/libexec/apache24/libphp.so
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/
|