在FreeBSD 10上安装PHP会出现编译错误


Installing PHP on FreeBSD 10 gives compilation error

我在我的系统上安装了apache 2.4

./configure --enable-so

MySQL设置和运行没有任何问题。但现在我试图安装PHP与这些参数:

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

使我收到错误:

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

请告诉我正确的方向

FreeBSD有ports集合。这是各种软件包的构建基础设施。如果您要查找的内容可以从端口获得,则最好使用它。因为其他人已经知道如何最好地安装程序了。

。要安装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

Edit:要获得libphp5.so,您需要激活EMBED选项。这不是默认值,所以在这种情况下你不能使用包。