PHP5.5をインストール
PHP5.5のインストール手順です!!
まずは、
# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
としてリポジトリを作成します。
# vi /etc/yum.repos.d/remi.repo
で作成されたリポジトリファイルを確認すると、
=============================
・
・
[remi-php55]
name=Les RPM de remi de PHP 5.5 pour Enterprise Linux 5 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/5/php55/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/5/php55/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
[remi-php56]
name=Les RPM de remi de PHP 5.6 pour Enterprise Linux 5 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/5/php56/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/5/php56/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
・
・
=============================
という記述があると思います。
[remi-php55]や[remi-php56]がリポジトリ名なので、
PHP5.5をインストールする場合は、
# yum install --enablerepo=remi-php55 php php-devel php-mbstring php-mcrypt php-mysql
を実行します。
※必要なPHPモジュールも一緒に入れておきます
インストールが完了したら、
念のために
# php -v
でバージョンを確認してみます。
=============================
PHP 5.5.28 (cli) (built: Aug 6 2015 08:53:05)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
=============================
と表示されたので、
無事PHP5.5のインストールが完了です!!
因みに、
PHPバージョン5.6をインストールする場合には、
# yum install --enablerepo=remi-php56 php php-devel php-mbstring php-mcrypt php-mysql
としてインストールすればOKです。
ここまでくれば、
あとは、
PHPとNginxの連動です。
まずは、
先ほど追加したPHP5.5のリポジトリから「PHP-FPM」をインストールします。
# yum --enablerepo=remi-php55 install php php-fpm
で、
PHPの起動ユーザをnginxに変更します。
# vi /etc/php-fpm.d/www.conf
=============================
user = apache
を
user = nginx
に変更
group = apache
を
group = nginx
に変更
=============================
PHP-FPMを起動します。
# service php-fpm start
サーバ起動時にPHP-FPMが起動するように設定を変更します。
# /sbin/chkconfig php-fpm on
「nginx.conf」の編集を行います。
# vi /etc/nginx/nginx.conf
とし、以下を追加します。
=============================
location ~ \.php($|/) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/google.jp.net/www/google.jp.net/$fastcgi_script_name;
include fastcgi_params;
}
=============================
あと、
「index.php」をインデックスファイルに追加する場合には、
以下の追記も必要になってきます。
=============================
index index.html index.htm index.php;
=============================
最後に、Nginxを再起動します。
# service nginx restart
これで、
NginxからPHPを実行できるようになりました。
この後は、
データベースとしてMySQLをインストールしていきます。
この記事へのコメントはありません。