web-dev-qa-db-ja.com

Ubuntu Server 12.10にPerl用のpecl拡張機能をインストールできない

PhpファイルからPerlスクリプトを呼び出す必要があります。

Perl用のPECL拡張機能をインストールしようとしました。

私は失敗しました。

私は次を試しました:

pecl channel-update pear.php.net
Updating channel "pear.php.net"
Update of Channel "pear.php.net" succeeded


pecl install Perl
downloading Perl-1.0.0.tgz ...
Starting to download Perl-1.0.0.tgz (24,358 bytes)
.....done: 24,358 bytes
Validation Error: No release notes found
Parsing of package.xml from file "/tmp/pear/temp/peartf4IJH/package.xml" failed
Download of "pecl/Perl" succeeded, but it is not a valid package archive
Error: cannot download "pear/Perl"
Download failed
install failed

Ubuntuサーバ12.10を実行しています。 My PHPバージョンは

PHP 5.4.6-1ubuntu1.1 (cli) (built: Nov 15 2012 01:18:34) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans

私のPerlバージョンは

This is Perl 5, version 14, Subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi
(with 64 registered patches, see Perl -V for more detail)

Copyright 1987-2011, Larry Wall

更新:

Perl用の最新のPeclインストールを2013年1月23日に試しました

1.0.1とラベル付けされました

pecl install Perlを実行した後、次のものを取得しました

downloading Perl-1.0.1.tgz ...
Starting to download Perl-1.0.1.tgz (25,282 bytes)
.........done: 25,282 bytes
5 source files, building
running: phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
Perl: warning: Setting locale failed.
Perl: warning: Please check that your locale settings:
    LANGUAGE = "en_SG:en",
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_SG.UTF-8"
    are supported and installed on your system.
Perl: warning: Falling back to the standard locale ("C").
Perl: warning: Setting locale failed.
Perl: warning: Please check that your locale settings:
    LANGUAGE = "en_SG:en",
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_SG.UTF-8"
    are supported and installed on your system.
Perl: warning: Falling back to the standard locale ("C").
building in /tmp/pear/temp/pear-build-rootcxwYP8/Perl-1.0.1
running: /tmp/pear/temp/Perl/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/20100525
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 for Perl support... yes, shared
checking how to print strings... printf
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 how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
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 dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) nawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
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 -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
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/bash /tmp/pear/temp/pear-build-rootcxwYP8/Perl-1.0.1/libtool --mode=compile cc  -I. -I/tmp/pear/temp/Perl -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootcxwYP8/Perl-1.0.1/include -I/tmp/pear/temp/pear-build-rootcxwYP8/Perl-1.0.1/main -I/tmp/pear/temp/Perl -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  -DHAVE_CONFIG_H  -g -O2 -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/Perl/5.14/CORE  -c /tmp/pear/temp/Perl/php_Perl.c -o php_Perl.lo
libtool: compile:  cc -I. -I/tmp/pear/temp/Perl -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootcxwYP8/Perl-1.0.1/include -I/tmp/pear/temp/pear-build-rootcxwYP8/Perl-1.0.1/main -I/tmp/pear/temp/Perl -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 -DHAVE_CONFIG_H -g -O2 -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/Perl/5.14/CORE -c /tmp/pear/temp/Perl/php_Perl.c  -fPIC -DPIC -o .libs/php_Perl.o
/tmp/pear/temp/Perl/php_Perl.c:186:3: warning: initialization from incompatible pointer type [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:186:3: warning: (near initialization for 'php_Perl_object_handlers.read_property') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:187:3: warning: initialization from incompatible pointer type [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:187:3: warning: (near initialization for 'php_Perl_object_handlers.write_property') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:193:3: warning: initialization from incompatible pointer type [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:193:3: warning: (near initialization for 'php_Perl_object_handlers.has_property') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:194:3: warning: initialization from incompatible pointer type [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:194:3: warning: (near initialization for 'php_Perl_object_handlers.unset_property') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:198:3: warning: initialization from incompatible pointer type [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:198:3: warning: (near initialization for 'php_Perl_object_handlers.get_method') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:199:3: warning: initialization from incompatible pointer type [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:199:3: warning: (near initialization for 'php_Perl_object_handlers.call_method') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:202:3: warning: initialization from incompatible pointer type [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:202:3: warning: (near initialization for 'php_Perl_object_handlers.get_class_name') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:213:3: warning: initialization from incompatible pointer type [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:213:3: warning: (near initialization for 'php_Perl_proxy_handlers.read_property') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:214:3: warning: initialization from incompatible pointer type [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:214:3: warning: (near initialization for 'php_Perl_proxy_handlers.write_property') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:220:3: warning: initialization from incompatible pointer type [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:220:3: warning: (near initialization for 'php_Perl_proxy_handlers.has_property') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:221:3: warning: initialization from incompatible pointer type [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:221:3: warning: (near initialization for 'php_Perl_proxy_handlers.unset_property') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:225:3: warning: initialization from incompatible pointer type [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:225:3: warning: (near initialization for 'php_Perl_proxy_handlers.get_method') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:226:3: warning: initialization from incompatible pointer type [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:226:3: warning: (near initialization for 'php_Perl_proxy_handlers.call_method') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:229:3: warning: initialization from incompatible pointer type [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:229:3: warning: (near initialization for 'php_Perl_proxy_handlers.get_class_name') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:247:1: warning: excess elements in struct initializer [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c:247:1: warning: (near initialization for 'php_Perl_constructor_function') [enabled by default]
/tmp/pear/temp/Perl/php_Perl.c: In function 'php_Perl_sv_to_zval_noref':
/tmp/pear/temp/Perl/php_Perl.c:540:7: warning: passing argument 3 of 'Perl_sv_2pv_flags' from incompatible pointer type [enabled by default]
In file included from /usr/lib/Perl/5.14/CORE/Perl.h:5036:0,
                 from /tmp/pear/temp/Perl/php_Perl.c:38:
/usr/lib/Perl/5.14/CORE/proto.h:3565:21: note: expected 'STRLEN * const' but argument is of type 'int *'
/tmp/pear/temp/Perl/php_Perl.c:587:18: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'unsigned int' [-Wformat]
/tmp/pear/temp/Perl/php_Perl.c: In function 'php_Perl_call_method':
/tmp/pear/temp/Perl/php_Perl.c:680:11: warning: passing argument 3 of 'Perl_sv_2pv_flags' from incompatible pointer type [enabled by default]
In file included from /usr/lib/Perl/5.14/CORE/Perl.h:5036:0,
                 from /tmp/pear/temp/Perl/php_Perl.c:38:
/usr/lib/Perl/5.14/CORE/proto.h:3565:21: note: expected 'STRLEN * const' but argument is of type 'int *'
/tmp/pear/temp/Perl/php_Perl.c: In function 'php_Perl_call':
/tmp/pear/temp/Perl/php_Perl.c:743:11: warning: passing argument 3 of 'Perl_sv_2pv_flags' from incompatible pointer type [enabled by default]
In file included from /usr/lib/Perl/5.14/CORE/Perl.h:5036:0,
                 from /tmp/pear/temp/Perl/php_Perl.c:38:
/usr/lib/Perl/5.14/CORE/proto.h:3565:21: note: expected 'STRLEN * const' but argument is of type 'int *'
/tmp/pear/temp/Perl/php_Perl.c: In function 'php_Perl_get_method':
/tmp/pear/temp/Perl/php_Perl.c:1418:5: error: too few arguments to function 'zend_get_std_object_handlers()->get_method'
/tmp/pear/temp/Perl/php_Perl.c: In function 'php_Perl_get_properties':
/tmp/pear/temp/Perl/php_Perl.c:1496:29: error: 'znode_op' has no member named 'op_type'
/tmp/pear/temp/Perl/php_Perl.c:1497:29: error: 'znode_op' has no member named 'u'
/tmp/pear/temp/Perl/php_Perl.c:1498:12: error: 'znode_op' has no member named 'u'
/tmp/pear/temp/Perl/php_Perl.c:1498:12: error: 'znode_op' has no member named 'u'
/tmp/pear/temp/Perl/php_Perl.c:1499:12: error: 'znode_op' has no member named 'u'
/tmp/pear/temp/Perl/php_Perl.c:1499:12: error: 'znode_op' has no member named 'u'
/tmp/pear/temp/Perl/php_Perl.c:1500:12: error: 'znode_op' has no member named 'u'
/tmp/pear/temp/Perl/php_Perl.c:1500:12: error: 'znode_op' has no member named 'u'
/tmp/pear/temp/Perl/php_Perl.c:1501:12: error: 'znode_op' has no member named 'u'
/tmp/pear/temp/Perl/php_Perl.c:1501:12: error: 'znode_op' has no member named 'u'
/tmp/pear/temp/Perl/php_Perl.c:1502:12: error: 'znode_op' has no member named 'u'
/tmp/pear/temp/Perl/php_Perl.c:1502:12: error: 'znode_op' has no member named 'u'
/tmp/pear/temp/Perl/php_Perl.c: In function 'php_Perl_clone':
/tmp/pear/temp/Perl/php_Perl.c:1666:7: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'unsigned int' [-Wformat]
/tmp/pear/temp/Perl/php_Perl.c: In function 'zm_info_Perl':
/tmp/pear/temp/Perl/php_Perl.c:1843:3: warning: unknown conversion type character 'v' in format [-Wformat]
/tmp/pear/temp/Perl/php_Perl.c: In function 'zim_Perl_eval':
/tmp/pear/temp/Perl/php_Perl.c:1905:13: warning: passing argument 3 of 'Perl_sv_2pv_flags' from incompatible pointer type [enabled by default]
In file included from /usr/lib/Perl/5.14/CORE/Perl.h:5036:0,
                 from /tmp/pear/temp/Perl/php_Perl.c:38:
/usr/lib/Perl/5.14/CORE/proto.h:3565:21: note: expected 'STRLEN * const' but argument is of type 'int *'
make: *** [php_Perl.lo] Error 1
ERROR: `make' failed
www-data@ubuntu-server:/var/virtual/storyzer.com/testperl$ exit
logout
2
Kim Stacks

この回答は2013年1月29日時点で有効です。

まず、ubuntuの内部で

wget http://pecl.php.net/get/Perl-1.0.1.tgz

http://pecl.php.net/package/Perl からtgzファイルをダウンロードするには

Tarを解凍します

tar -zxvf Perl-1.0.1.tgz

非圧縮フォルダーに移動します

cd Perl-1.0.1

現在のphp_Perl.cを削除するのは、何らかの理由で、私のphp5では機能しなかったためです。

Githubリポジトリから別のphp_Perl.cをダウンロードします https://github.com/do-aki/php-ext-Perl

wget https://raw.github.com/do-aki/php-ext-Perl/a3d7db22eb7964ea9cb39ea2f866d10df26655d4/php_Perl.c

この行ごとに実行する

export PHP_PREFIX="/usr"
export Perl_PREFIX="/usr"
$PHP_PREFIX/bin/phpize
./configure --with-Perl=$Perl_PREFIX --with-php-config=$PHP_PREFIX/bin/php-config
make  

/usr/bin/ld: cannot find -lperlのようなエラーが発生した場合は、インストールする必要があります

Sudo apt-get install libperl-dev

拡張機能をインストールします(この手順にはルート権限が必要になる場合があります)

make install

Php.iniにPerl拡張機能を追加します(この手順にはルート権限が必要になる場合があります)

extension=Perl.so

Php5-fpmを再起動します

Sudo /etc/init.d/php5-fpm restart

Perlを実行すると、ロケールに関する問題が発生する場合があります。

欠落しているロケールを見てください。 en_SGとen_SG.UTF-8がないと仮定します

試して

Sudo locale-gen en_SG en_SG.UTF-8
Sudo dpkg-reconfigure locales

その後、再起動します。

それでもロケールの問題がある場合は、

試して

Sudo nano /etc/environment

欠落しているロケールをLC_ALLに追加します

LC_ALL = "en_SG.UTF-8"

リブート。

#Perlのtm064と#ubuntuのNullDevに感謝します。このソリューションを手伝ってくれました。

1
Kim Stacks