13,005
回編集
(→CentOS) |
|||
7行目: | 7行目: | ||
<br><br> | <br><br> | ||
== PHPのインストール == | == PHPのインストール (パッケージ管理システムからインストールする場合) == | ||
==== | ==== RHEL ==== | ||
もし、PHP 5がインストールされている場合は、PHP 5アンインストールする。<br> | |||
<br> | |||
この時、php.iniファイルを変更している場合はバックアップを取得する。<br> | |||
これは、新しいPHPをインストールした時点でphp.iniファイルが上書きされるためである。<br> | これは、新しいPHPをインストールした時点でphp.iniファイルが上書きされるためである。<br> | ||
sudo | sudo dnf remove php-* | ||
<br> | <br> | ||
次に、[[設定 - EPELリポジトリとRemiリポジトリ]]を参照して、EPELリポジトリとRemiリポジトリを追加する。<br> | 次に、[[設定 - EPELリポジトリとRemiリポジトリ]]を参照して、EPELリポジトリとRemiリポジトリを追加する。<br> | ||
<br> | <br> | ||
<code>--enablerepo</code>オプションを付加して、PHPをインストールする。<br> | |||
アップデート後は、php.iniファイルが上書きされているのでバックアップから復元する。<br> | アップデート後は、php.iniファイルが上書きされているのでバックアップから復元する。<br> | ||
sudo | sudo dnf --enablerepo=remi-php73 install php php-cli.x86_64 php-pdo.x86_64 php-gd.x86_64 php-mbstring.x86_64 php-common.x86_64 php-mysql php73-devel | ||
<br> | <br> | ||
==== SUSE ==== | |||
* PHP 7をインストールする場合 | * PHP 7をインストールする場合 | ||
*: PHPおよび主要なPHPモジュールをインストールする。 | *: PHPおよび主要なPHPモジュールをインストールする。 | ||
51行目: | 49行目: | ||
**: <code> php8-openssl php8-devel php8-fpm php8-fileinfo php8-phar</code> | **: <code> php8-openssl php8-devel php8-fpm php8-fileinfo php8-phar</code> | ||
<br> | <br> | ||
==== Raspberry Pi ==== | |||
まず、lsb-releaseをインストールする。<br> | まず、lsb-releaseをインストールする。<br> | ||
sudo apt-get install lsb-release | sudo apt-get install lsb-release | ||
74行目: | 71行目: | ||
# PHP 7.4 | # PHP 7.4 | ||
sudo apt-get install php7.4 php7.4-cli php7.4-mysql php7.4-mbstring php7.4-gd php7.4-zip php7.4-xml php7.4-common php7.4-curl php7.4-intl | sudo apt-get install php7.4 php7.4-cli php7.4-mysql php7.4-mbstring php7.4-gd php7.4-zip php7.4-xml php7.4-common php7.4-curl php7.4-intl | ||
<br> | <br><br> | ||
== | |||
== PHPのインストール (ソースコードからインストールする場合) == | |||
複数のPHPのバージョンをインストールする場合、ソースコードからインストールする方が融通が利く。<br> | 複数のPHPのバージョンをインストールする場合、ソースコードからインストールする方が融通が利く。<br> | ||
<br> | <br> | ||
99行目: | 97行目: | ||
--enable-opcache --enable-phpdbg --enable-phpdbg-debug --enable-sockets \ | --enable-opcache --enable-phpdbg --enable-phpdbg-debug --enable-sockets \ | ||
--enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-shmop --enable-soap --enable-zts \ | --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-shmop --enable-soap --enable-zts \ | ||
--with-curl --with-expat -with-freetype --with-gettext --with-gmp --with-iconv --with-jpeg --with-kerberos \ | --with-curl --with-expat -with-freetype --with-gettext --with-gmp --with-iconv --with-jpeg --with-kerberos \ | ||
--with-imap --with-imap-ssl --with-libdir=lib64 \ | --with-imap --with-imap-ssl --with-libdir=lib64 \ | ||
--with-libxml --with-mcrypt --with-mhash --with-openssl --with-pic --with-readline --with-sodium --with-tidy --with-xpm --with-zip \ | --with-libxml --with-mcrypt --with-mhash --with-openssl --with-pic --with-readline --with-sodium --with-tidy --with-xpm --with-zip \ | ||
--with-zlib --with-unixODBC=shared \ | --with-zlib --with-unixODBC=shared \ | ||
--with-apxs2=/<Apacheのインストールディレクトリ>/bin/apxs \ | |||
--with-mysql-sock \ | --with-mysql-sock \ | ||
--with-mysqli=mysqlnd \ # MySQL拡張モジュールであるmysqliMySQL Native Driverでビルドする | --with-mysqli=mysqlnd \ # MySQL拡張モジュールであるmysqliMySQL Native Driverでビルドする | ||
--with-pdo-mysql=mysqlnd \ # MySQL拡張モジュールであるPDO MYSQLをMySQL Native Driverでビルドする | --with-pdo-mysql=mysqlnd \ # MySQL拡張モジュールであるPDO MYSQLをMySQL Native Driverでビルドする | ||
--with-pgsql \ | --with-pgsql \ # PostgresSQLを使用する場合 | ||
--with-pdo-pgsql \ | --with-pdo-pgsql \ # PostgresSQLを使用する場合 | ||
--with-config-file-path=<php.iniファイルの配置するパス> # ユーザが指定する場合 | --with-config-file-path=<php.iniファイルの配置するパス> # ユーザが指定する場合 | ||