"cpanm PHP" 失败

"cpanm PHP" fails

我应该更改什么才能安装该模块? php 是 5.3.3,yum install php-devel 到位。

PHP.c: In function ‘PHP_set_php_input’:
PHP.c:818: warning: passing argument 2 of ‘Perl_sv_2pv_flags’ from incompatible pointer type
/home/mpapec/.plenv/versions/5.20.0/lib/perl5/5.20.0/x86_64-linux/CORE/proto.h:3931: note: expected ‘STRLEN * const’ but argument is of type ‘int *’
cc -c  -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 -Wall -O2   -DVERSION=\"0.15\" -DXS_VERSION=\"0.15\" -fPIC "-I/home/mpapec/.plenv/versions/5.20.0/lib/perl5/5.20.0/x86_64-linux/CORE"   array.c
In file included from /usr/include/php/main/php.h:33,
                 from /usr/include/php/sapi/embed/php_embed.h:23,
                 from PHP.h:14,
                 from array.c:9:
/usr/include/php/main/php_config.h:2417:1: warning: "_GNU_SOURCE" redefined
In file included from /home/mpapec/.plenv/versions/5.20.0/lib/perl5/5.20.0/x86_64-linux/CORE/perl.h:28,
                 from PHP.h:9,
                 from array.c:9:
/home/mpapec/.plenv/versions/5.20.0/lib/perl5/5.20.0/x86_64-linux/CORE/config.h:1825:1: warning: this is the location of the previous definition
rm -f blib/arch/auto/PHP/PHP.so
cc  -shared -O2 -L/usr/local/lib -fstack-protector PHP.o array.o  -o blib/arch/auto/PHP/PHP.so  \
                \

chmod 755 blib/arch/auto/PHP/PHP.so
"/home/mpapec/.plenv/versions/5.20.0/bin/perl5.20.0" -MExtUtils::Command::MM -e 'cp_nonempty' -- PHP.bs blib/arch/auto/PHP/PHP.bs 644
Manifying 1 pod document
Running Mkbootstrap for PHP ()
chmod 644 "PHP.bs"
PERL_DL_NONLAZY=1 "/home/mpapec/.plenv/versions/5.20.0/bin/perl5.20.0" "-Iblib/lib" "-Iblib/arch" test.pl
1..79
not ok 1 - use_ok PHP
#   Failed test 'use_ok PHP'
#   at test.pl line 11.
not ok 2 - require PHP;
#   Failed test 'require PHP;'
#   at test.pl line 18.
#     Tried to require 'PHP'.
#     Error:  Attempt to reload PHP.pm aborted.
# Compilation failed in require at (eval 6) line 2.
not ok 3 - eval
#   Failed test 'eval'
#   at test.pl line 49.
Module PHP failed to load at blib/lib/PHP.pm line 80.
Module PHP failed to load at blib/lib/PHP.pm line 80.
END failed--call queue aborted at test.pl line 50.
# Looks like you planned 79 tests but ran 3.
# Looks like you failed 3 tests of 3 run.
# Looks like your test exited with 22 just after 3.
make: *** [test_dynamic] Error 22
-> FAIL Installing PHP failed. See /home/mpapec/.cpanm/work/1440522239.12833/build.log for details. Retry with --force to force install it.
(

PHP 有点脆弱。它可能无法与您的系统 php 安装开箱即用,并且可能无法与 perl.

的 64 位或多线程版本一起使用

我只在 Linux 上使用过它。我尝试使用的最新版本是 5.3.8(早在 2013 年),但我记得从 5.2.x 到 5.3.8.

一切顺利

我总是从源代码构建 php,配置如下:

./configure --enable-embed --with-zlib --with-openssl --with-mysql \
        --with-libdir=lib/i386-linux-gnu

--enable-embed 是绝对需要的,正如 pod 提到的那样,构建一个带有 SAPI 扩展的 PHP 解释器,然后允许 perl 通过 XS 代码操作 PHP 解释器.其他扩展是为了满足我项目的其他要求;它们可能是可选的,但我还没有尝试使用任何其他配置构建 PHP 解释器或 PHP 模块。 pod 还说永远不要使用 --with-apxs 参数,无论如何我都不想这样做。

PHP 模块的构建过程将查找并需要一个名为 php-config 的程序。您可能需要破解您的 $PATH,即使只是在构建过程中,以便 PHP 模块运行正确的 php-config。之后,该模块将知道在哪里寻找您的 php 安装的其余部分。

我有一段时间使用这个模块很开心(写了一个 Catalyst,然后是一个围绕 WordPress 的 Mojolicious 包装器),但它已经年久失修,声名狼藉。分享您在尝试构建它时学到的任何东西,我们会将其放入文档中,使该模块更易于使用。