LoginSignup
3
3

More than 5 years have passed since last update.

php7 + pthreadsインストールメモ

Posted at

今まではremiのphp7を使っていたのだけど、データ解析用のphpが遅いのでpthreadsで並列化することに。

wget http://jp2.php.net/get/php-7.0.9.tar.bz2/from/this/mirror
php-7.0.9.tar.bz2にリネームして解凍
wget http://pecl.php.net/get/pthreads-3.1.6.tgz
解凍してphp-7.0.9/ext/pthreadsに移動

php-7.0.9ディレクトリで
./buildconf --force
./configure --enable-debug --enable-maintainer-zts --enable-pthreads --enable-mbstring --prefix=/usr --with-config-file-path=/etc

configure: error: xml2-config not found. Please check your libxml2 installation.
sudo yum install libxml2
sudo yum install libxml2-devel

make
sudo make install

sudo cp php-development.ini /etc/php.ini
Include_path = " /usr/lib/php/"
を追加記載

これで、通常のWeb等で使うPHPは
/opt/remi/php70/root/usr/bin/php
マルチスレッドで使いたい時は
/usr/bin/php
で使い分けれるようになる。

実際の並列効果は・・・
VCPUが8コアなのでPool(8)でやっているがCPU使用率が70%くらいで留まっている。
6時間位かかっている処理が1時間くらいで済むようになると嬉しいのだが・・・

3
3
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
3
3