lubuntu-14.04 PHP PECL install pthreads 結果は・・・ | 乖離のぶろぐ(*´∀`)吸い込んで応援
(゚ω゚) 動かん。phpのテスト環境も壊されてしまう。
(゚ω゚) lubuntu-14.04 でpthreadsを使おうと考えてはいけない。


http://php.net/manual/ja/book.pthreads.php
(゚ω゚) thread classを使いたいから、pthreadsをインストール。
root@lubuntu-VirtualBox:/usr/share/php# pecl install pthreads
downloading pthreads-2.0.10.tgz ...
Starting to download pthreads-2.0.10.tgz (85,247 bytes)
....................done: 85,247 bytes
36 source files, building
running: phpize
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
building in /tmp/pear/temp/pear-build-rootYs4DMm/pthreads-2.0.10
running: /tmp/pear/temp/pthreads/configure
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable Threading API... yes, shared
checking whether to enable pedantic locking... no
checking checking for ZTS... configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled
ERROR: `/tmp/pear/temp/pthreads/configure' failed
root@lubuntu-VirtualBox:/usr/share/php#

(゚ω゚) エラー終了した。phpのmakeが必要なのか?
http://php.net/manual/ja/pthreads.installation.php#114837

http://php.net/manual/ja/pthreads.requirements.php
pthreads を使うには、ビルド時に ZTS を有効 ( --enable-maintainer-zts、あるいは Windows なら --enable-zts ) にする必要があります。

(゚ω゚)ここのブログが、分かりやすい。真似する。
http://eddmann.com/posts/compiling-php-5-5-with-zts-and-pthreads-support/
Compiling PHP 5.5 with ZTS and pthreads Support
Published: 30th Jan 2014

$ VERSION=5.5.8 # set version
$ yum install -y wget libxml2-devel
$ cd /usr/local/src
$ wget http://www.php.net/distributions/php-$VERSION.tar.gz
$ tar zxvf php-$VERSION.tar.gz
$ cd /usr/local/src/php-$VERSION
$ ./configure --prefix=/usr --with-config-file-path=/etc --enable-maintainer-zts
$ make
$ make install
$ cp php.ini-development /etc/php.ini

(゚ω゚) php -v でバージョンを調べると、5.5.9だった。

lubuntu@lubuntu-VirtualBox:~$ php -v
PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
lubuntu@lubuntu-VirtualBox:~$

(゚ω゚) yum install -y wget libxml2-devel をヤラナイデ、
(゚ω゚) configureするとエラー終了。

Configuring extensions
checking size of long... (cached) 8
checking size of int... (cached) 4
checking for int32_t... yes
checking for uint32_t... yes
checking for sys/types.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for string.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for strtoll... yes
checking for atoll... yes
checking for strftime... (cached) yes
checking which regex library to use... php
checking whether to enable LIBXML support... yes
checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.

(゚ω゚) not found ってなにかが足りない。
(゚ω゚) wget は既に入っているから、libxml2-develをSynapticでインストールした。
libxml2-dev
Development files for the GNOME XML library

(゚ω゚) 再度、configureすると正常終了。
Configuring extensions
checking size of long... (cached) 8
checking size of int... (cached) 4
checking for int32_t... yes
checking for uint32_t... yes
checking for sys/types.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for string.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for strtoll... yes
checking for atoll... yes
checking for strftime... (cached) yes
checking which regex library to use... php
checking whether to enable LIBXML support... yes
checking libxml2 install dir... no
checking for xml2-config path... /usr/bin/xml2-config
checking whether libxml build works... yes
checking for OpenSSL support... no
checking for Kerberos support... no
checking for PCRE library to use... bundled
(゚ω゚)省略

Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands

(゚ω゚) phpをmakeしてmake install
root@lubuntu-VirtualBox:/usr/local/src/php-5.5.9# make
/bin/bash /usr/local/src/php-5.5.9/libtool --silent --preserve-dup-deps --mode=compile /usr/local/src/php-5.5.9/meta_ccld -Iext/opcache/ -I/usr/local/src/php-5.5.9/ext/opcache/ -DPHP_ATOM_INC -I/usr/local/src/php-5.5.9/include -I/usr/local/src/php-5.5.9/main -I/usr/local/src/php-5.5.9 -I/usr/local/src/php-5.5.9/ext/date/lib -I/usr/local/src/php-5.5.9/ext/ereg/regex -I/usr/include/libxml2 -I/usr/local/src/php-5.5.9/ext/sqlite3/libsqlite -I/usr/local/src/php-5.5.9/TSRM -I/usr/local/src/php-5.5.9/Zend -D_REENTRANT -I/usr/include -g -O2 -fvisibility=hidden -pthread -DZTS -c /usr/local/src/php-5.5.9/ext/opcache/ZendAccelerator.c -o ext/opcache/ZendAccelerator.lo
/bin/bash /usr/local/src/php-5.5.9/libtool --silent --preserve-dup-deps --mode=compile /usr/local/src/php-5.5.9/meta_ccld -Iext/opcache/ -I/usr/local/src/php-5.5.9/ext/opcache/ -DPHP_ATOM_INC -I/usr/local/src/php-5.5.9/include -I/usr/local/src/php-5.5.9/main -I/usr/local/src/php-5.5.9 -I/usr/local/src/php-5.5.9/ext/date/lib -I/usr/local/src/php-5.5.9/ext/ereg/regex -I/usr/include/libxml2 -I/usr/local/src/php-5.5.9/ext/sqlite3/libsqlite -I/usr/local/src/php-5.5.9/TSRM -I/usr/local/src/php-5.5.9/Zend -D_REENTRANT -I/usr/include -g -O2 -fvisibility=hidden -pthread -DZTS -c /usr/local/src/php-5.5.9/ext/opcache/zend_accelerator_blacklist.c -o ext/opcache/zend_accelerator_blacklist.lo
(゚ω゚)省略

root@lubuntu-VirtualBox:/usr/local/src/php-5.5.9# make install

(゚ω゚) 再度、thread classを使いたいから、pthreadsをインストール。
root@lubuntu-VirtualBox:/etc/php5/mods-available# pecl install pthreads
downloading pthreads-2.0.10.tar ...
Starting to download pthreads-2.0.10.tar (Unknown size)
........................done: 490,496 bytes
36 source files, building
running: phpize
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
building in /tmp/pear/temp/pear-build-rootBTsqkK/pthreads-2.0.10
running: /tmp/pear/temp/pthreads/configure
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib/php/extensions/no-debug-zts-20121212
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable Threading API... yes, shared
checking whether to enable pedantic locking... no
checking checking for ZTS... ok
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

(゚ω゚)省略

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-rootmKPDhQ/install-pthreads-2.0.10" install
Installing shared extensions: /tmp/pear/temp/pear-build-rootmKPDhQ/install-pthreads-2.0.10/usr/lib/php/extensions/no-debug-zts-20121212/
running: find "/tmp/pear/temp/pear-build-rootmKPDhQ/install-pthreads-2.0.10" | xargs ls -dils
307881 4 drwxr-xr-x 3 root root 4096 11月 30 05:36 /tmp/pear/temp/pear-build-rootmKPDhQ/install-pthreads-2.0.10
307887 4 drwxr-xr-x 3 root root 4096 11月 30 05:36 /tmp/pear/temp/pear-build-rootmKPDhQ/install-pthreads-2.0.10/usr
307888 4 drwxr-xr-x 3 root root 4096 11月 30 05:36 /tmp/pear/temp/pear-build-rootmKPDhQ/install-pthreads-2.0.10/usr/lib
307889 4 drwxr-xr-x 3 root root 4096 11月 30 05:36 /tmp/pear/temp/pear-build-rootmKPDhQ/install-pthreads-2.0.10/usr/lib/php
307890 4 drwxr-xr-x 3 root root 4096 11月 30 05:36 /tmp/pear/temp/pear-build-rootmKPDhQ/install-pthreads-2.0.10/usr/lib/php/extensions
307891 4 drwxr-xr-x 2 root root 4096 11月 30 05:36 /tmp/pear/temp/pear-build-rootmKPDhQ/install-pthreads-2.0.10/usr/lib/php/extensions/no-debug-zts-20121212
263724 464 -rwxr-xr-x 1 root root 472966 11月 30 05:36 /tmp/pear/temp/pear-build-rootmKPDhQ/install-pthreads-2.0.10/usr/lib/php/extensions/no-debug-zts-20121212/pthreads.so

Build process completed successfully
Installing '/usr/lib/php/extensions/no-debug-zts-20121212/pthreads.so'
install ok: channel://pecl.php.net/pthreads-2.0.10
configuration option "php_ini" is not set to php.ini location
You should add "extension=pthreads.so" to php.ini
root@lubuntu-VirtualBox:/usr/local/src/php-5.5.9# ls -la /usr/lib/php/extensions/no-debug-zts-20121212/pthreads.so
-rw-r--r-- 1 root root 472966 11月 30 05:36 /usr/lib/php/extensions/no-debug-zts-20121212/pthreads.so
root@lubuntu-VirtualBox:/usr/local/src/php-5.5.9#

(゚ω゚) pthreads.soが作成できたから、php.iniへ追加・・・