2

为了安装模块,我应该改变什么?php 是 5.3.3yum 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.
(
4

1 回答 1

5

PHP有点脆弱。它可能不适用于您的系统php安装,并且在 64 位或多线程版本的perl.

我只让它在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 模块。吊舱还说永远不要使用--with-apxs参数,无论如何我都不想这样做。

模块的构建过程PHP将寻找并需要一个名为php-config. $PATH如果只是在构建过程中,您可能需要破解您PHPphp-config. 之后,该模块将知道在哪里查找您的 php 安装的其余部分。

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

于 2015-08-25T18:21:07.373 回答