在FreeBSD 10上安装PHP会产生编译错误

时间:2014-06-27 20:13:20

标签: php gnu-make freebsd

我使用

在我的系统上安装了apache 2.4
./configure --enable-so

然后MySQL设置并运行没有问题。但现在我正在尝试使用以下参数安装PHP:

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql

make 上,我收到错误:

ext/standard/info.o: In function `php_info_print':
/root/php-5.5.13/ext/standard/info.c:97: undefined reference to `ts_resource_ex'
/root/php-5.5.13/ext/standard/info.c:97: undefined reference to `ts_resource_ex'
/root/php-5.5.13/ext/standard/info.c:97: undefined reference to `ts_resource_ex'
/root/php-5.5.13/ext/standard/info.c:97: undefined reference to `ts_resource_ex'
ext/standard/info.o: In function `php_info_printf':
/root/php-5.5.13/ext/standard/info.c:83: undefined reference to `ts_resource_ex'
ext/standard/info.o:/root/php-5.5.13/ext/standard/info.c:97: more undefined references to `ts_resource_ex' follow
ext/standard/info.o: In function `php_print_info':
/root/php-5.5.13/ext/standard/info.c:869: undefined reference to `executor_globals_id'
/root/php-5.5.13/ext/standard/info.c:872: undefined reference to `executor_globals_id'
/root/php-5.5.13/ext/standard/info.c:875: undefined reference to `executor_globals_id'
/root/php-5.5.13/ext/standard/info.c:878: undefined reference to `executor_globals_id'
ext/standard/info.o: In function `php_info_print':
/root/php-5.5.13/ext/standard/info.c:97: undefined reference to `ts_resource_ex'
/root/php-5.5.13/ext/standard/info.c:97: undefined reference to `ts_resource_ex'
/root/php-5.5.13/ext/standard/info.c:97: undefined reference to `ts_resource_ex'
/root/php-5.5.13/ext/standard/info.c:97: undefined reference to `ts_resource_ex'
/root/php-5.5.13/ext/standard/info.c:97: undefined reference to `ts_resource_ex'
ext/standard/info.o:/root/php-5.5.13/ext/standard/info.c:97: more undefined references to `ts_resource_ex' follow
ext/standard/info.o: In function `php_print_gpcse_array':
/root/php-5.5.13/ext/standard/info.c:204: undefined reference to `executor_globals_id'
ext/standard/info.o: In function `php_info_print':
/root/php-5.5.13/ext/standard/info.c:97: undefined reference to `ts_resource_ex'
/root/php-5.5.13/ext/standard/info.c:97: undefined reference to `ts_resource_ex'
/root/php-5.5.13/ext/standard/info.c:97: undefined reference to `ts_resource_ex'
/root/php-5.5.13/ext/standard/info.c:97: undefined reference to `ts_resource_ex'
ext/standard/info.o: In function `php_info_print_html_esc':
/root/php-5.5.13/ext/standard/info.c:69: undefined reference to `ts_resource_ex'
ext/standard/info.o:/root/php-5.5.13/ext/standard/info.c:97: more undefined references to `ts_resource_ex' follow
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make: stopped in /root/php-5.5.13

指出我正确的方向plz:)

1 个答案:

答案 0 :(得分:1)

FreeBSD有ports collection。这是适用于各种软件包的构建基础架构。如果你想要的东西可以从港口获得,最好使用它。因为其他人已经知道如何最好地安装程序。

E.g。要安装php5,请切换到root用户,转到/usr/ports/lang/php5并输入命令make install clean。这将为您编译和安装PHP,包括它所依赖的任何内容。

很多港口都有选择;您可以更改的配置项。如果您使用端口的默认配置,则可以将其安装为预构建的包。例如。寻找PHP 5包;

> pkg search php5|less
ja-php5-mecab-0.5.0
mod_php5-5.4.29,1
mod_php55-5.5.13
php5-5.4.29
php5-Ice-3.5.1
php5-arcanist-20140508_2
php5-bcmath-5.4.29
php5-blitz-0.8.2
php5-blitz-devel-0.7.2
php5-bsdconv-11.1.0
...

然后安装你想要的那个;

# pkg install php5-5.4.29
Updating repository catalogue
The following 1 packages will be installed:

    Installing php5: 5.4.29

The installation will require 15 MB more space

2 MB to be downloaded

Proceed with installing packages [y/N]: y

修改:要获得libphp5.so,您需要激活EMBED选项。这不是默认值,因此在这种情况下您不能使用包。