10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS6.5にPHP5.5(+pThreads)をインストールする

Last updated at Posted at 2014-10-24

概要

pThreadsを有効にしたPHPをLinuxにインストールするためには、yumで配布されるパッケージでは無理で、ソースコードからビルドする必要があります。

インストール手順

remiリポジトリをインストール

PHP5.4以降をパッケージでインストールするには、remiリポジトリが欠かせません。
本来この手順ではPHPはソースからインストールするので必要ないのですが、yumで入れる事になる関連ライブラリのバージョン不整合が怖いので入れて置いた方が無難だと考えます。

remiリポジトリの追加手順
$ cd /etc/yum.repos.d
$ sudo wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
$ sudo rpm -Uvh remi-release-6.rpm

必要パッケージのインストール

必要となるパッケージをインストールします。
なお、この手順ではかなりザックリ入れているため、PHP+pThreadsを動かすという観点においてはおそらく過剰です。
気になる人はブラッシュアップをお願いします。

インストール手順
$ sudo yum groupinstall -y --enablerepo=remi "Development Tools"
$ sudo yum groupinstall -y --enablerepo=remi "Development Libraries"
$ sudo yum install -y --enablerepo=remi wget ftp gcc make zlib-devel git gcc-c++ readline-devel openssl-devel nkf libxml2-devel
$ sudo yum install -y --enablerepo=remi httpd httpd-devel mod_ssl cronolog

PHP5.5のインストール

お約束通り、configure/make/make installする。
configureオプションに注意。

インストール手順
$ mkdir ~/src
$ cd ~/src
$ wget http://php.net/distributions/php-5.5.18.tar.gz
$ tar zxvf php-5.5.18.tar.gz
$ cd php-5.5.18

# enable-maintainer-ztsスイッチがpThreadsを使うために必須
$ ./configure --prefix=/usr --with-config-file-path=/etc --enable-maintainer-zts
$ make
$ sudo make install

# サンプルの設定ファイルを設置。この後は各自で編集する。
$ sudo cp php.ini-development /etc/php.ini

pThreadsのインスール

pThreadsはPECLを利用してインストールする。

インストール手順
$ sudo pecl install pthreads

# php.iniに追記しないと有効化されない
$ sudo echo "extension=pthreads.so" >> /etc/php.ini

# インストール確認。pthreadsと表示されればOK
$ php -m | grep pthreads
pthreads

以上です。

10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?