AWS EC2で nginx php55-fpm phalcon を動かす。

AWS EC2で nginx & php55-fpm 上で phalcon を動かしてみた。本当はphp5.6が入れたいんですが・・。手間が2段階ぐらい上がっちゃうんですよね。

まず、nginxをインストール。

# yum install nginx

php用のリポジトリを追加。

# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

remiのphp5.5を有効にしておきましょう。

# vi /etc/yum.repos.d/remi.repo

[remi]
name=Les RPM de remi pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php55]
name=Les RPM de remi de PHP 5.5 pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/php55/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/php55/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi]と[remi-php55]のenableを1に。

で、php5.5系をどどっとインストールします。

# yum install php55 php55-devel php55-fpm php55-mbstring php55-mcrypt php55-opcache php55-pdo

phalconの為のgccとgitもついでに。

# yum install gcc git

phalconをダウンロード。

$ git clone git://github.com/phalcon/cphalcon.git

でインストール。

cd cphalcon/build/
# ./install

phalconの設定ファイルを作りましょう。

# vi /etc/php-5.5.d/phalcon.ini

extension=phalcon.so

それでは順番に起動していきます。

# /etc/init.d/php-fpm start
# /etc/init.d/nginx start

特にエラーもなければ、自動起動にしておきましょう。

# /sbin/chkconfig nginx on
# /sbin/chkconfig php-fpm on

後は、nginxの設定をすればとりあえず動くところまではいったと思います。