Интересно почитать… Блог в котором есть много интересной информации…

30 августа 2011

Кто такой PHP RunKit и как его инсталлировать под Ubuntu Linux

Категория: программирование — dmitriano @ 20:46

Для чего нужен PHP RunKit

PHP RunKit нужен для того, чтобы делать вот такие штуки:

// небольшой хак
runkit_constant_redefine('JPATH_COMPONENT', JPATH_BASE.DS.'components'.DS.'com_content');

...

// возвращаем все на место
runkit_constant_redefine('JPATH_COMPONENT', $old_jpath_component);

Ставим PHP RunKit

Сначала надо поставить php-pear:

# apt-get install php-pear
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-2.6.32-31 linux-headers-2.6.32-31-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  php5-cli
Suggested packages:
  php5-dev
The following NEW packages will be installed:
  php-pear php5-cli
0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
Need to get 3,172kB of archives.
After this operation, 10.2MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main php5-cli 5.3.2-1ubuntu4.9 [2,817kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main php-pear 5.3.2-1ubuntu4.9 [355kB]
Fetched 3,172kB in 5s (573kB/s)
Selecting previously deselected package php5-cli.
(Reading database ... 185276 files and directories currently installed.)
Unpacking php5-cli (from .../php5-cli_5.3.2-1ubuntu4.9_i386.deb) ...
Selecting previously deselected package php-pear.
Unpacking php-pear (from .../php-pear_5.3.2-1ubuntu4.9_all.deb) ...
Processing triggers for man-db ...
Setting up php5-cli (5.3.2-1ubuntu4.9) ...

Creating config file /etc/php5/cli/php.ini with new version
update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode.

Setting up php-pear (5.3.2-1ubuntu4.9) ...

теперь ставим собственно сам RunKit, получается вот такая штука:

# pecl install channel://pecl.php.net/runkit-0.9
downloading runkit-0.9.tgz ...
Starting to download runkit-0.9.tgz (49,807 bytes)
.............done: 49,807 bytes
14 source files, building
running: phpize
sh: phpize: not found
ERROR: `phpize' failed

чтобы у нас был phpize надо ставить php5-dev:

# apt-get install php5-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-2.6.32-31 linux-headers-2.6.32-31-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  autoconf automake autotools-dev libltdl-dev libssl-dev libtool shtool zlib1g-dev
Suggested packages:
  autoconf2.13 autoconf-archive gnu-standards autoconf-doc gettext libtool-doc automaken gfortran fortran95-compiler gcj
The following NEW packages will be installed:
  autoconf automake autotools-dev libltdl-dev libssl-dev libtool php5-dev shtool zlib1g-dev
0 upgraded, 9 newly installed, 0 to remove and 3 not upgraded.
Need to get 4,895kB of archives.
After this operation, 16.6MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ lucid/main autoconf 2.65-3ubuntu1 [772kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ lucid/main autotools-dev 20090611.1 [64.1kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ lucid/main automake 1:1.11.1-1 [608kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ lucid/main libltdl-dev 2.2.6b-2ubuntu1 [193kB]
Get:5 http://us.archive.ubuntu.com/ubuntu/ lucid/main zlib1g-dev 1:1.2.3.3.dfsg-15ubuntu1 [162kB]
Get:6 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main libssl-dev 0.9.8k-7ubuntu8.6 [2,007kB]
Get:7 http://us.archive.ubuntu.com/ubuntu/ lucid/main libtool 2.2.6b-2ubuntu1 [524kB]
Get:8 http://us.archive.ubuntu.com/ubuntu/ lucid/main shtool 2.0.8-3 [160kB]
Get:9 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main php5-dev 5.3.2-1ubuntu4.9 [405kB]
Fetched 4,895kB in 9s (513kB/s)
Selecting previously deselected package autoconf.
(Reading database ... 185478 files and directories currently installed.)
Unpacking autoconf (from .../autoconf_2.65-3ubuntu1_all.deb) ...
Selecting previously deselected package autotools-dev.
Unpacking autotools-dev (from .../autotools-dev_20090611.1_all.deb) ...
Selecting previously deselected package automake.
Unpacking automake (from .../automake_1%3a1.11.1-1_all.deb) ...
Selecting previously deselected package libltdl-dev.
Unpacking libltdl-dev (from .../libltdl-dev_2.2.6b-2ubuntu1_i386.deb) ...
Selecting previously deselected package zlib1g-dev.
Unpacking zlib1g-dev (from .../zlib1g-dev_1%3a1.2.3.3.dfsg-15ubuntu1_i386.deb) ...
Selecting previously deselected package libssl-dev.
Unpacking libssl-dev (from .../libssl-dev_0.9.8k-7ubuntu8.6_i386.deb) ...
Selecting previously deselected package libtool.
Unpacking libtool (from .../libtool_2.2.6b-2ubuntu1_i386.deb) ...
Selecting previously deselected package shtool.
Unpacking shtool (from .../shtool_2.0.8-3_all.deb) ...
Selecting previously deselected package php5-dev.
Unpacking php5-dev (from .../php5-dev_5.3.2-1ubuntu4.9_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for doc-base ...
Processing 1 added doc-base file(s)...
Registering documents with scrollkeeper...
Processing triggers for install-info ...
Setting up autoconf (2.65-3ubuntu1) ...
Setting up autotools-dev (20090611.1) ...
Setting up automake (1:1.11.1-1) ...
update-alternatives: using /usr/bin/automake-1.11 to provide /usr/bin/automake (automake) in auto mode.

Setting up libltdl-dev (2.2.6b-2ubuntu1) ...
Setting up zlib1g-dev (1:1.2.3.3.dfsg-15ubuntu1) ...
Setting up libssl-dev (0.9.8k-7ubuntu8.6) ...
Setting up libtool (2.2.6b-2ubuntu1) ...
Setting up shtool (2.0.8-3) ...
Setting up php5-dev (5.3.2-1ubuntu4.9) ...
update-alternatives: using /usr/bin/php-config5 to provide /usr/bin/php-config (php-config) in auto mode.
update-alternatives: using /usr/bin/phpize5 to provide /usr/bin/phpize (phpize) in auto mode.

теперь делаем вторую попытку:

# pecl install channel://pecl.php.net/runkit-0.9
downloading runkit-0.9.tgz ...
Starting to download runkit-0.9.tgz (49,807 bytes)
.............done: 49,807 bytes
14 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
building in /tmp/pear/temp/pear-build-rootSyXV1g/runkit-0.9
running: /tmp/pear/temp/runkit/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... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-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 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
checking for PHP extension directory... /usr/lib/php5/20090626+lfs
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... gawk
checking whether to enable runkit support... yes, shared
checking wheter to enable runtime manipulation of functions/classes/constants... yes, shared
checking whether to enable registration of user-defined autoglobals... yes, shared
checking whether to enable Sandbox support... yes, shared
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from cc object... ok
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 for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) 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
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/bash /tmp/pear/temp/pear-build-rootSyXV1g/runkit-0.9/libtool --mode=compile cc  -I. -I/tmp/pear/temp/runkit -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootSyXV1g/runkit-0.9/include -I/tmp/pear/temp/pear-build-rootSyXV1g/runkit-0.9/main -I/tmp/pear/temp/runkit -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 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/runkit/runkit.c -o runkit.lo
libtool: compile:  cc -I. -I/tmp/pear/temp/runkit -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootSyXV1g/runkit-0.9/include -I/tmp/pear/temp/pear-build-rootSyXV1g/runkit-0.9/main -I/tmp/pear/temp/runkit -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 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/runkit/runkit.c  -fPIC -DPIC -o .libs/runkit.o
/tmp/pear/temp/runkit/runkit.c: In function Б─≤zif_runkit_zval_inspectБ─≥:
/tmp/pear/temp/runkit/runkit.c:61: error: Б─≤zvalБ─≥ has no member named Б─≤refcountБ─≥
/tmp/pear/temp/runkit/runkit.c:62: error: Б─≤zvalБ─≥ has no member named Б─≤is_refБ─≥
/tmp/pear/temp/runkit/runkit.c: In function Б─≤zm_deactivate_runkitБ─≥:
/tmp/pear/temp/runkit/runkit.c:360: warning: passing argument 2 of Б─≤zend_hash_applyБ─≥ from incompatible pointer type
/usr/include/php5/Zend/zend_hash.h:138: note: expected Б─≤apply_func_tБ─≥ but argument is of type Б─≤int (*)(char *)Б─≥
/tmp/pear/temp/runkit/runkit.c:370: warning: passing argument 2 of Б─≤zend_hash_applyБ─≥ from incompatible pointer type
/usr/include/php5/Zend/zend_hash.h:138: note: expected Б─≤apply_func_tБ─≥ but argument is of type Б─≤int (*)(struct zend_hash_key *)Б─≥
/tmp/pear/temp/runkit/runkit.c:378: warning: passing argument 2 of Б─≤zend_hash_apply_with_argumentsБ─≥ from incompatible pointer type
/usr/include/php5/Zend/zend_hash.h:140: note: expected Б─≤apply_func_args_tБ─≥ but argument is of type Б─≤int (*)(struct zend_internal_function *, int,  char *, struct zend_hash_key *)Б─≥
make: *** [runkit.lo] Error 1
ERROR: `make' failed

так… runkit не компилируется… смотрим, что написано тут http://pecl.php.net/package/runkit:

For all those things you…. probably shouldn’t have been doing anyway…. WARNING: 0.9 does not compile with PHP 5.2+ so use the CVS version instead.

Значит надо брать исходники, а для этого надо поставить SVN:

# apt-get install subversion
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-2.6.32-31 linux-headers-2.6.32-31-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libsvn1
Suggested packages:
  subversion-tools db4.8-util patch
The following NEW packages will be installed:
  libsvn1 subversion
0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
Need to get 1,210kB of archives.
After this operation, 6,291kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main libsvn1 1.6.6dfsg-2ubuntu1.3 [840kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main subversion 1.6.6dfsg-2ubuntu1.3 [370kB]
Fetched 1,210kB in 2s (511kB/s)
Selecting previously deselected package libsvn1.
(Reading database ... 187325 files and directories currently installed.)
Unpacking libsvn1 (from .../libsvn1_1.6.6dfsg-2ubuntu1.3_i386.deb) ...
Selecting previously deselected package subversion.
Unpacking subversion (from .../subversion_1.6.6dfsg-2ubuntu1.3_i386.deb) ...
Processing triggers for man-db ...
Setting up libsvn1 (1.6.6dfsg-2ubuntu1.3) ...

Setting up subversion (1.6.6dfsg-2ubuntu1.3) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

теперь берем исходники:

$ svn checkout http://svn.php.net/repository/pecl/runkit/trunk/
A    trunk/config.w32
A    trunk/runkit_methods.c
A    trunk/runkit_props.c
A    trunk/config.m4
...
A    trunk/tests/Runkit_Sandbox__disable_functions.phpt
A    trunk/php_runkit.h
A    trunk/runkit_classes.c
A    trunk/runkit_sandbox.c
A    trunk/tsrm_5.0.diff
 U   trunk
Checked out revision 315793.

и собираем вручную:

# cd trunk/
# pecl install package.xml
....
Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-rootlVuuey/install-runkit-
Installing shared extensions:     /tmp/pear/temp/pear-build-rootlVuuey/install-r
running: find "/tmp/pear/temp/pear-build-rootlVuuey/install-runkit-0.9" | xargs
90812   4 drwxr-xr-x 3 root root   4096 2011-08-30 20:33 /tmp/pear/temp/pear-bui
90816   4 drwxr-xr-x 3 root root   4096 2011-08-30 20:33 /tmp/pear/temp/pear-bui
90817   4 drwxr-xr-x 3 root root   4096 2011-08-30 20:33 /tmp/pear/temp/pear-bui
90818   4 drwxr-xr-x 3 root root   4096 2011-08-30 20:33 /tmp/pear/temp/pear-bui
90819   4 drwxr-xr-x 2 root root   4096 2011-08-30 20:33 /tmp/pear/temp/pear-bui/20090626+lfs
28719 188 -rwxr-xr-x 1 root root 192009 2011-08-30 20:33 /tmp/pear/temp/pear-bui/20090626+lfs/runkit.so

Build process completed successfully
Installing '/usr/lib/php5/20090626+lfs/runkit.so'
install ok: channel://pecl.php.net/runkit-0.9
configuration option "php_ini" is not set to php.ini location
You should add "extension=runkit.so" to php.ini

добавляем это в php.ini:

; If you only provide the name of the extension, PHP will look for it in its
; default extension directory.
;

extension=runkit.so

в результате RunKit отлично работает!

Линии 3D/Шарики 3D

Комментариев нет »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

SlogPost.ru